0

3-What is the difference between protected and private access specifiers in inheritance? a. private member is not inheritable an

4th Sep 2018, 3:04 AM
Punam Mundada
Punam Mundada - avatar
3 ответов
0
private attributes and modules can't accessed outside of the class so they can't even be inherited. protected ones instead can only be accessed by subclasses (so they can be inherited) in java if you live something that isn't nor private nor public nor protected, it will be no description that means that can be used only in the current package
4th Sep 2018, 6:56 AM
Daniele Bonomi
Daniele Bonomi - avatar
0
Punam Mundada both are not public and can not be accessed outside class without public method... now, concern is why two different options then... reason is that it is having importance when you inherit... if something is private, you can not access same directly in inherited class... for protected members, you can access them in inherited class..
4th Sep 2018, 7:39 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
4th Sep 2018, 7:40 AM
Ketan Lalcheta
Ketan Lalcheta - avatar