+ 7

What is the difference between private and protected class??

Programming https://www.sololearn.com/discuss/1316935/?ref=app

29th Apr 2019, 2:59 AM
Er Rajnikant
Er Rajnikant - avatar
7 Réponses
+ 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. 👍🏻👍🏻
5th Jul 2019, 6:23 PM
Tushar
Tushar - avatar
+ 8
Private members of a class are not inheritable wheras the protected members of a class are inheritable to derived class.
6th Jul 2019, 2:40 AM
White
White - avatar
+ 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.
29th Apr 2019, 6:57 AM
Sonic
Sonic - avatar
+ 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
29th Apr 2019, 6:35 AM
Da2
Da2 - avatar
+ 1
Private class is not at all accessible. protected class is accessible but only to derived class..
15th Sep 2019, 4:08 AM
Priyanshu Kashyap
Priyanshu Kashyap - avatar
- 1
Welcom
30th Apr 2019, 11:18 PM
Mohamed Bolahrouz