Create a class named
'PrintNumber' to print various numbers of different datatypes by creating
different methods with the same name 'printn' having a parameter for each
datatype.
#include <iostream>
using namespace std;
class PrintNumber
{
public:
void printn(int a)
{
cout<<a<< endl;
}
void printn(float a)
{
cout<<a<< endl;
}
void printn(double a)
{
cout<<a<<endl;
}
};
int main()
{
PrintNumber obj;
obj.printn(2);
obj.printn(2.5);
obj.printn(2.123456);
}