CONSTRUCTOR OVERLOADING
#include "iostream.h"
#include "conio.h"
class con
{
private:
int a,b;
public:
con ()
{
a = b = 0;
}
con (int x)
{
a = x;
b = 0;
}
con (int x, int y)
{
a = x;
b = y;
}
void display ()
{
cout << a << endl;
cout << b << endl << endl;
}
};
void main ()
{
clrscr ();
con C;
con C1(10);
con C2(20,30);
C.display ();
C1.display ();
C2.display ();
getch ();
}
Get the executable ( .exe ) file for this program..
Download
No comments:
Post a Comment