In: Computer Science
risks involved with using the protected member access specifier instead of the private member access specifier?
Explanation:
A private member access specifier is only accessible within the same class as it is declared.
A protected member access specifier is accessible within all classes in the same package and within sub classes in other packages.
Risks involved with using the protected member access specifier instead of the private member access specifier:
The following table depicts the
Class |
Package |
Subclass (same pkg) |
Subclass (diff pkg) |
World |
|
protected |
+ | + | + | + | |
private |
+ |
+ : accessible blank : not accessible