Class inheritance (source code)

= Class inheritance

= Inheritance in object-oriented programming
{synonym}

Class inheritance defines a <software class> using another <software class>'s implementation and may add or override behavior. When it also establishes <subtyping>, the derived <software class> must satisfy the base <software class>'s behavioral contract for clients to substitute it safely. Code reuse alone is not sufficient justification for an inheritance relationship. <Object composition> often better represents a <software object> containing a replaceable component.