+ 2

Difference between public, private and protected access specifiers in cpp?

cpp

19th Mar 2017, 3:05 AM
c s gujral
c s gujral - avatar
2 Respostas
+ 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
19th Mar 2017, 4:22 AM
Jafca
Jafca - avatar
+ 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.
19th Mar 2017, 6:55 AM
Abed Nego Ragil Putra
Abed Nego Ragil Putra - avatar