This AI is still in early stages of development.
Inheritance Model
- Aubergine
Owned by Aubergine
Implementation of traditional prototypal inheritance model, including ability to call superclass methods.
Â
Overview
While Javascript uses a prototypal inheritance model internally, it's generally too cumbersome for script authors to use in their scripts. It's a shame, because prototypal inheritance has no impact on object instantiation performance. Unlike "extends" approaches that developers sometimes use, prototypal inheritance also has the benefit of being able to add new methods and properties to instantiated objects by changing the superclass prototype.
To make prototypal inheritance more accessible and easier to work with, the Util API provides two functions:
- function.inherit() – inherit a superclass on to your class
- object.super() – an easy way to call methods on the superclass, or the superclass constructor
Objects that use prototypal inheritance are instantiated as usual, using the new operator.
Inheritance Model
Topics:
- object.super() — Call a superclass method or constructor from within the class method (of same name) or constructor.
- function.inherit() — Simplifies the implementation and use of classical Javascript prototypal inheritance.
Â