C++ Programming Code Examples C++ > Beginners Lab Assignments Code Examples Polymorphism is a feature using which an object behaves differently in different situation. Polymorphism is a feature using which an object behaves differently in different situation. Function overloading and Operator overloading are examples of polymorphism. In function overloading we can have more than one function with same name but different numbers, type or sequence of arguments. #include <iostream> using namespace std; class Sum { public: int add(int num1,int num2){ return num1 + num2; } int add(int num1, int num2, int num3){ return num1 + num2 + num3; } }; int main(void) { //Object of class Sum Sum obj; //This will call the second add function cout<<obj.add(10, 20, 30)<<endl; //This will call the first add function cout<<obj.add(11, 22); return 0; }