Function Overloading: polymorphism

  c++

Email

#include<iostream>

using namespace std;

class Anil{

public :

void fun(int x)
{

cout << “the x alues of the function”<< x<< endl;
}
void fun(double x)
{

cout << “this coding wokring” << x<< endl;

}

void fun(int x, int y )
{

cout << “this coding of the best”<< x << y << endl;
}
};

int main()
{

Anil o;

o.fun(5);
o.fun(5);
o.fun(11,225);

return 0;

}

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of