Which access specifier in C++ allows a class member to be accessible only within the class and friends of the class? 

  • public 
  • private 
  • protected 
  • external
The private access specifier in C++ ensures that class members are only accessible within the class and not outside. Additionally, friend functions or classes can access these private members, but they remain hidden from other parts of the program.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *