July 2019
Intermediate to advanced
410 pages
10h 32m
English
Inheritance helps us to define a child class. This child class inherits the behavior of the parent or base class.
Let's take a look at the different types of inheritance:
Let's revisit the PetAnimal class previously mentioned and, instead, use inheritance to define our Dog and Cat classes. With inheritance, we can define some attributes that are common for both. For example, the name of the pet and the color of the pet would be common, so they would be located in a base class. The specifics of a cat or a dog would ...
Read now
Unlock full access