I am looking for the best term to use to describe a child that inherits an ancestor.
For example, a 'Car' object may derive from its ancestor 'Vehicle'. However, is there a better/more suitable word to use than derivative for the inverse?
Depending on your programming language, a class can have multiple parents. While an ancestor class, is any superclass of your class (a parent class, a parent of a parent class and so on).
Inheritance in OOP = When a class derives from another class. The child class will inherit all the public and protected properties and methods from the parent class. In addition, it can have its own properties and methods. An inherited class is defined by using the extends keyword.
A derived class is a class created or derived from another existing class. The existing class from which the derived class is created through the process of inheritance is known as a base class or superclass.
Inheritance is one of the most important aspects of Object Oriented Programming (OOP). The key to understanding Inheritance is that it provides code re-usability. In place of writing the same code, again and again, we can simply inherit the properties of one class into the other.
Ancestor/Descendant are a more common pairing when there can be intermediate layers between the items under discussion.
E.g. if we have Vehicle
-> Wheeled Vehicle
-> Car
(and assuming other possible classes also exist), both Vehicle
and Wheeled Vehicle
are ancestors of Car
and both Wheeled Vehicle
and Car
are descendants of Vehicle
. We would describe Vehicle
as the parent of Wheeled Vehicle
and Car
as a child of Wheeled Vehicle
but we wouldn't generally use parent or child to describe the relationship between Vehicle
and Car
.
"Inherited class" and "derived class" work well. At times instances of objects have parent/child relationships that have nothing to do with inheritance, like parent nodes and child nodes. In those cases referring to "parent" and "child" classes in the same context could be confusing.
Also, using the parent/child metaphor, every child is a parent, not every parent is a child, and some classes are infertile (sealed.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With