Polymorphism is an object oriented programming concept that allows an entity to take on multiple forms. There are two main types of polymorphism: compile-time polymorphism which includes function overloading and operator overloading that allow functions and operators to have the same name but different parameters or definitions, and run-time polymorphism which is function overriding that allows a function in a child class to have the same name and parameters as a function in the parent class but different functionality.
Polymorphism is an object oriented programming concept that allows an entity to take on multiple forms. There are two main types of polymorphism: compile-time polymorphism which includes function overloading and operator overloading that allow functions and operators to have the same name but different parameters or definitions, and run-time polymorphism which is function overriding that allows a function in a child class to have the same name and parameters as a function in the parent class but different functionality.
Polymorphism is an object oriented programming concept that allows an entity to take on multiple forms. There are two main types of polymorphism: compile-time polymorphism which includes function overloading and operator overloading that allow functions and operators to have the same name but different parameters or definitions, and run-time polymorphism which is function overriding that allows a function in a child class to have the same name and parameters as a function in the parent class but different functionality.
Polymorphism • Word “Polymorphism” having many form • Polymorphism is feature of Object oriented programming which is the ability to display a single entity in more than one form is called Polymorphism • Types of Polymorphism • Compile-time Polymorphism – Function Overloading, Operator Overloading • Run-time Polymorphism – Function Overriding Function Overloading • Functions having the same name but different parameters and definition is called function overloading Operator Overloading • C++ provides the ability for an operator to perform more than one task that is called operator overloading • Such as + can be used to perform arithmetic addition on two numeric value but it can also be used for string operands to concatenate two strings Function Overriding • Function overriding is functions having the same name and parameter but different definitions is called is function overriding • For implementing Function overriding we require two classes Base and child class