Computer Science, asked by Mohit0, 1 year ago

Q.What are C++ access specifiers ?

Answers

Answered by Anshul2005b
0

Public - The members declared as Public are accessible from outside the Class through an object of the class.

Protected - The members declared as Protected are accessible from outside the class BUT only in a class derived from it.

Private - These members are only accessible from within the class.

thnx

Answered by saurav01234567890
0
Access specifiers are used to define how the members (functions and variables) can be accessed outside the class.



Private: Members declared as private are accessible only within the same class and they cannot be accessed outside the class they are declared. Child classes are also not allowed to access private members of parent.
Public: Members declared as public are accessible from anywhere.
Protected: Only the class and its child classes can access protected members.
Similar questions