Difference between inheritance and polymorhism ?
sathish
Select an image from your device to upload
Inheritance is one of the primary concepts of object-oriented programming. It allows you to reuse existing code. Through effective employment of reuse, you can save time in your programming. Inheritance is transitive in nature.There are two types of polymorphism:
1. Compile time polymorphism 2. Run time polymorphism.
Compile Time Polymorphism
Compile time polymorphism is method and operators overloading. It is also called early binding.
In method overloading method performs the different task at the different input parameters.
Runtime Time Polymorphism
Runtime time polymorphism is done using inheritance and virtual functions. Method overriding is called runtime polymorphism. It is also called late binding.
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same prototype.
Both inhertiance and polymorphism a corelated terms used with each other.