header files
class num
{
int a,b;
float c,d;
char s[5], s1[10];
public:
num(int x, int y) // constructor overloading
{
a=x;
b=y;
}
num(char str[10], char str1[15]) // constructor overloading
{
strcpy(s,s1);
strcpy(s1,str1);
}
num(float p) // constructor overloading
{
c=p;
d=555;
}
void display()
};
void num::display()
{
cout<<>
cout<<>
cout<<>
}
void main()
{
num obj(1000,5000);
num obj("Kumar","Dharsinisamy");
num obj(150.60);
obj.display();
}
Output will be
1000
5000
Kumar
Dharsinisamy
100.50
555
Friday, May 8, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment