As the name suggest one name many forms, Polymorphism is the way of providing the different functionality by the functions having the same name based on the signatures of the methods.
For example: method calculate_area will definitely work for circle, square and triangle object.
There are two type of polymorphism in C++
1. Compile time polymorphism
2. Run time polymorphism
In Method overloading, functions have same name but different no. of arguments, return type of the parameters.
• It can be implemented in both parent and child class.
• It is also known as compile time polymorphism.
In method overriding, redefining inherit methods in subclasses. In this, declaration should be identical, code may be different. It is like having another version of the same product.
• It can be used to add more functionality to a method.
• It is also called as run time polymorphism.
• In overriding, a method has same name, same no. of arguments and same data type.