Skip to content

Inheritance vs Polymorphism  #126

@Samtoosoon

Description

@Samtoosoon

Inheritance:

Inheritance is one in which a new class is created that inherits the properties of the already exist class. It supports the concept of code reusability and reduces the length of the code in object-oriented programming.

Types of Inheritance are:

  1. Single inheritance
  2. Multi-level inheritance
  3. Multiple inheritance
  4. Hybrid inheritance
  5. Hierarchical inheritance

Polymorphism:
Polymorphism is that in which we can perform a task in multiple forms or ways. It is applied to the functions or methods. Polymorphism allows the object to decide which form of the function to implement at compile-time as well as run-time.

Types of Polymorphism are:

  1. Compile-time polymorphism (Method overloading)
  2. Run-time polymorphism (Method Overriding)
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions