Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Advantages of Inheritance

Sumit Rawal answered on May 17, 2023 Popularity 6/10 Helpfulness 2/10

Contents


More Related Answers

  • What is the meaning of inheritance in C++. Write an example of simple inheritance.
  • Explain the different types of inheritance in Java
  • types of inheritance
  • What Is Inheritance?
  • composition over inheritance
  • Why Inheritance?
  • What is Inheritance?
  • • What is inheritance? Explain with example. Or differentiate between super class and subclass. Also write a program to show the reusability concept.

  • Advantages of Inheritance

    0

    Reusability

    Inheritance makes the code reusable. Consider that you are up for designing a banking system using classes. Your model might have these:

    A parent class: BankAccount

    A child class: SavingsAccount

    Another child class: CheckingAccount

    In the above example, you don’t need to duplicate the code for the deposit() and withdraw() methods inside the child classes, namely SavingsAccount and CheckingAccount. In this way, you can avoid the duplication of code.

    Popularity 6/10 Helpfulness 2/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 17 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.