Inheritance is an actively used design pattern created in 1969. In object-oriented programming, inheritance is the mechanism of basing an object or class upon another object (prototype-based inheritance) or class (class-based inheritance), retaining similar implementation.

50Years Old

Languages with Inheritance include javascript, python, typescript

Example from javascript:

class B {}
class A extends B {}

Example from python:

class SumComputer(object):
   def __init__(self, a, b):
       self.a = a
       self.b = b
   def transform(self, x):
       raise NotImplementedError
   def inputs(self):
       return range(self.a, self.b)
   def compute(self):
       return sum(self.transform(value) for value in self.inputs())
 class SquareSumComputer(SumComputer):
     def transform(self, x):
         return x * x
 class CubeSumComputer(SumComputer):
     def transform(self, x):
         return x * x * x

Example from typescript:

class B {}
class A extends B {}

Last updated August 9th, 2020

Edit Inheritance on GitHub