Inheritance
The concept of inheritance is modeled in object-oriented languages, enabling developers to write code in the form of hierarchical relationships. As facilitators of OOP, programmers can encapsulate a collection of behaviors and attributes into an isolated body known as an object. Such an object can then be used when you create additional objects, which you can do by deriving them from the original object. Much like children who benefit from the possessions of their mother and father, so can objects benefit through inheritance. Compartmentalized attributes and behaviors are used by child objects, creating a hierarchy between the two. A child object in a hierarchy of objects is referred to as a subclass, and its parent is referred to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access