There is an error printing mistake in page number 29 we found. The box in this page is corrected as follows.
Default constructor
|
Constructor with arguements
|
Constructor with default arguements
|
class ABC
{ int a,b;
public :
ABC()
{ a=50;b=20; }
void disp()
{ cout<<a<<b; }
};
void main()
{ ABC M,N;
M.disp(); // 5 3
N.disp(); // 5 3
getch();
}
|
class ABC
{ int a,b;
public :
ABC(int x,int y)
{ a=x;b=y; }
void disp()
{ cout<<a<<b; }
};
void main()
{ ABC M(5,3),N(100,150);
M.disp(); // 5 3
N.disp(); //100 50
getch();
}
|
class ABC
{ int a,b;
public :
ABC(int x=30,int y=60)
{ a=x;b=y; }
void disp()
{ cout<<a<<b; }
};
void main()
{ ABC M(5,3),N(100),Z;
M.disp(); // 5 3
N.disp(); //100 60
Z.disp(); //30 60
getch();
}
|
thank you.
മറുപടിഇല്ലാതാക്കൂ