A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

Function overloading of polymorphism in c++

#include<iostream>
using namespace std;
class A
{
    public:
        int add(int x, int y)
        {
            return x+y;
        }
       
        int add(int x, int y, int z)
        {
            return x+y+z;
        }
};

int main()
{
    A a;
    cout<<a.add(10,20);
    cout<<endl;
    cout<<a.add(10,20,30);
    return 0;
}











LEARN TUTORIALS

.

.