Advantages of Inheritance

In this lesson, you'll get to know about the advantages of Inheritance.

We have learned that we can implement inheritance which will result in avoiding redundant coding and will also save the programmer’s time and effort.

Avoiding Duplication of Code

Considering the previous example, if we have to implement another class for MoneyMarketAccount we don’t need to duplicate the code for the deposit() and withdraw() methods inside this new Class because we can inherit and use the parent class’s methods. In this way, we can avoid the duplication of code.

Get hands-on with 1200+ tech skills courses.