Polymorphism is one of the features of Object Oriented Programming Language. Polymorphism means having many forms. Polymorphism in C++ can be achieved in two ways:
- Compile Time
- Function Overloading
- Operator overloading
- Run Time
- Function overriding
- Virtual functions
Difference between Compile time and Run-time Polymorphismre
Compile Time Polymorphism: This has the name as it is known to the compiler what implementation of a function can be used at the time of compiling. It is also known as early or static binding or static linking.
Run Time Polymorphism: Here the implantation of function would be decided at the time of running program. It is also known as late or dynamic binding.
In this chapter, we are focusing on Compile Time Polymorphism. We will discuss about Runtime polymorphism later.