November 2019
Beginner
228 pages
2h 45m
English
As one of the OOP principles, inheritance is designed to centralize the common functionality of many different objects. As a result of that, it reduces duplicated code in many classes.
Inheritance introduces two types of classes: “superclass” and “subclass.” The subclass inherits from the superclass. The superclass is the same thing as the “base class.” The subclass contains not only all the methods and the fields inherited from the superclass, but also other methods and fields defined by the subclass.
For example, we define a new class called Sedan that inherits from the Car class we created earlier. The ...
Read now
Unlock full access