Sunday, December 6, 2009
CONSTRUCTOR OVERLOADING
,
Author: Raviteja
|
Filed Under:
c++
|
#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
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment