Opposite of 'Ancestor' in OOP

1.1k Views Asked by At

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?

3

There are 3 best solutions below

1
On BEST ANSWER

Parent and child

So a car derives from it's parent vehicle; and a vehicle has multiple children such as car, boat and plane.

0
On

"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.)

0
On

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.