Grokking Advanced JavaScript
0% completed
Inheritance
When one class takes the properties and methods of another class and then adds its own, the relationship is called inheritance. The class that gives its members is the parent class, also called the base class or superclass. The class that receives them is the child class, also called the derived class or subclass.
Inheritance lets several classes share one copy of common code. If cars, trucks, and electric cars all need a make, a model, and a start() method, those members are written once in a Vehicle class, and each specific class adds only what makes it different. A fix in
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%