Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
In the Java 2 training class I'm taking, the "In Packages and Inheritance" module states:
When you create a subclass, it cannot inherit any of the superclass's methods and variables that are restricted by access modifiers.A s I understood it, the access modifier
private would not prevent inheritance but would prevent access (overloading/overriding) by a subclass. Also, a subclass inherits
all the methods and attributes of its superclass(es), and visibility modifiers affect this: private methods and attributes
cannot be accessed in a subclass. You'd have to use protected to allow subclass access. Can you clear up my confusion?
Trust yourself my friend!
You are absolutely correct. Access modifiers do not prevent inheritance. Instead, access modifiers affect what you can and cannot see in the subclass.
Those private members and attributes are still in your subclasses. Your subclasses just cannot access them directly.
Let's review the access modifiers:
I use the following rules of thumb to determine access levels:
final.
protected unless I know that a subclass absolutely needs it. In general, I do not declare methods and attributes as protected in the chance that a subclass may need it sometime in the future. If my design does not justify it explicitly, I declare
everything that is not in the public interface as private.