PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Inheritance

Inheritance

Inheritance is a feature.

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.


Languages with Inheritance include Java, JavaScript, Python, PHP, Scala, TypeScript, Dart, CoffeeScript, Groovy, Pug, SystemVerilog, Twig, Apex

Example from JavaScript, TypeScript:
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
garbage-collection-feature.html 路 inheritance-feature.html 路 iterators-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com