A relationship between entities in which one acts in a major role and the other in a minor role. Also an inheritance relationship paradigm.
In software, a parent-child relationship may involve ownership and/or containership semantics.
Ownership usually makes allocation, initialization, and destruction of child nodes the responsibility of the parent node.
Containership in a visual system often makes rendering, coordinate systems, clipping, and z-order of the child nodes the responsibility of the parent node.
For Object Oriented inheritance the parent is the base class and the child is the derived class.
A C++ example of a parent class: A
and a child class: B
:
class A{};
class B : public A{};