+ 2
Difference between public, private and protected access specifiers in cpp?
cpp
2 Answers
+ 17
Public: any class can acces it
Private: only that class can access it
Protected: only that class and its derived classes can access it
+ 3
Public variables, are variables that are visible to all classes. Private variables, are variables that are visible only to the class to which they belong. Protected variables, are variables that are visible only to the class to which they belong, and any subclasses.