What Is Inheritance?
Get introduced to Inheritance, a powerful concept in Object-Oriented Programming.
We'll cover the following
Definition
Inheritance provides a way to create a new class from an existing class. The new class is a specialized version of the existing class such that it inherits all the non-private fields (variables) and methods of the existing class. The existing class is used as a starting point or as a base to create the new class.
The IS A Relationship
After reading the above definition, the next question that comes to mind is this: when do we use inheritance? Wherever we come across an IS A relationship between classes, we can use inheritance.
Get hands-on with 1400+ tech skills courses.