April 2024
Beginner to intermediate
500 pages
24h 20m
English
In this chapter we learned about inheritance, the ability to design and implement classes that take advantage of natural relationships existing between them. These relationships provide a way for us to organize our classes. Superclasses contain general details (instance variables and methods) that pertain to an object. Subclasses contain details that allow objects to be more specific. This parent–child relationship, called an IS-A relationship, allows child objects to have all the functionality of parent objects while adding specific additional details. Another relationship called HAS-A exists when an object of one class is an instance variable of another class. This relationship is also called composition.
Read now
Unlock full access