“For example, you saw that the Student class can add additional properties and methods to handle a student’s grades. These properties and methods are available to any Person class instances but fully available to Student subclasses.” (5th Edition, page 339)
Should this be “These properties and methods are NOT available to any Person class instances …” ?
@ertugrul Thanks very much for your question!
They are in fact fully available to the subclass. A subclass is a child of the parent class, and as in real life, you typically “inherit” the qualities from your parents (e.g. hair color, skin color), but you also have unique qualities of your own (e.g. personality). So by default, the properties and function of a parent class are also available to instances of its subclass
I hope this helps!
All the best.
This topic was automatically closed after 166 days. New replies are no longer allowed.