+ 2
Generally speaking a super class only has access to the subclasses members that are shared and/or overridden in the sub class. A super class doesn't have access to members of a sub class that do not also exist within the super class. For example, if a super class had a method named doStuff() and the sub class had overridden this method within its class body giving the sub class its own description of this method, then a polymorphic object of the super class will be able to access this method. However, if the sub class also had another method named doSomeOtherStuff(), but the super class did not have this method, then a polymorphic object of the super class will not be able to access the doSomeOtherStuff() method, as it is not a part of the super class's description, and will throw an error.
28th Dec 2017, 3:18 AM
ChaoticDawg
ChaoticDawg - avatar