What are private, public and protected access specifiers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What are private, public and protected access specifiers?

7th Mar 2017, 6:34 PM
Abenezer Seleshi
3 Answers
+ 10
protected is also called 'package private'. Can be accessed by all derived classes and by all classes inside the same package.
7th Mar 2017, 6:53 PM
Tashi N
Tashi N - avatar
+ 7
*Private means thet this object can't be accessed outside of the class even if you derive its class. *Public means that the object can be accessed outside the class and can be derived. *Protected is Simillar to the private but when you derive a class to another the object can be accessed.
7th Mar 2017, 6:40 PM
Michael Ehab Mikhail
Michael Ehab Mikhail - avatar
+ 2
i agree with ehab
7th Mar 2017, 6:47 PM
Elkiro FoxTech
Elkiro FoxTech - avatar