#include<iostream>
using namespace std;
class Name
{
public:
void tell(string s){cout<<"Your name is "<<s<<endl;}
void tell(int i){cout<<"Your age is "<<i<<endl;}
};
int main()
{ Name m; string s;
while(s!="n")
{
cout<<"Input your name or age"<<endl;
cin>> s;
m.tell(s);
}
return 0;
}
The variable 's' should be able to store an int as well as string argument, without losing its type; so that, the 'int' overload gets invoked when I pass an int argument and the 'string' overload gets invoked when I pass a string argument to tell()