Differential inheritance is a common
inheritance
Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offici ...
model used by
prototype-based programming languages such as
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
,
Io and
NewtonScript
NewtonScript is a prototype-based programming language created to write programs for the Newton platform. It is heavily influenced by the Self programming language, but modified to be more suited to needs of mobile and embedded devices.
Hist ...
. It operates on the principle that most objects are derived from other, more general objects, and only differ in a few small aspects; while usually maintaining a list of pointers internally to other objects which the object differs from.
An analogy
To think of differential inheritance, you think in terms of what is different. So for instance, when trying to describe to someone how
Dumbo
''Dumbo'' is a 1941 American animated fantasy film produced by Walt Disney Productions and released by RKO Radio Pictures. The fourth Disney animated feature film, it is based upon the storyline written by Helen Aberson and Harold Pearl, a ...
looks, you could tell them in terms of elephants: ''Think of an elephant. Now Dumbo is a lot shorter, has big ears, no tusks, a little pink bow and can fly.'' Using this method, you don't need to go on and on about what makes up an elephant, you only need to describe the differences; anything not explicitly different can be safely assumed to be the same.
See also
*
Single inheritance
Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object o ...
External links
* from MDN Web Docs
Prototype-based programming
{{soft-eng-stub