adspace
Explain the different access specifiers for the class member in c++.
Answer Posted / Isha Vishnoi
In C++, there are three different access specifiers for class members: public (default), private, and protected. Public members can be accessed from anywhere including within the class, outside the class, or even by a derived class. Private members can only be accessed from within the same class they were declared in, but not from outside the class or derived classes. Protected members are similar to private members but can also be accessed by a derived class.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers