skip to main | skip to sidebar

Friday, May 8, 2009

Parameterized Constructor

header files

class num
{
int a,b;
public:
num(int x, int y) // Parameterized constructor
{
a=x;
b=y;
}
void display()

};

void num::display()
{
cout<
cout<
}
void main()
{
num obj(1000,5000);
obj.display();
}

Output will be

1000
5000

No comments:

Post a Comment

[フレーム]

Subscribe to: Post Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /