+ 7
What is the difference between private and protected class??
Programming https://www.sololearn.com/discuss/1316935/?ref=app
6 Answers
+ 24
There is very small difference which is that members in private cannot be used directly outside the class but members in protected can only be accessed by a derived class.
đđ»đđ»
+ 8
Private members of a class are not inheritable wheras the protected members of a class are inheritable to derived class.
+ 7
Private members are only accessible from within the class whereas protected members are accessible from within the class and its child classes, and in the case of PHP also from within parent classes.
+ 3
Private is an issue of visibility where it is only accesible within the method it is declared. Protected is an issue of accesibility where only selected methods can access it
+ 1
Private class is not at all accessible. protected class is accessible but only to derived class..
- 1
Welcom