Friday, May 8, 2009

CONSTRUCTOR - Default Constructor

header files

class num
{
int a,b;
public:
num() // default constructor
{
a=100;
b=200;
}
void display()

};

void num::display()
{
cout<<>
cout<<>
}
void main()
{
num obj;
obj.display();
}

Output will be

100
200

No comments:

Post a Comment