Tuesday, October 14, 2008

7.1 PROGRAM TO IMPLEMENT PARAMETERIZED CONSTRUCTORS

#include
#include

class sub
{
int a,b,c,d,e;
public:
sub()
{
a=5;
b=6;
c=40;
d=50;
e=a+b+c+d;
}
sub(int x,int y)
{
a=x;
b=y;
e=a+b;
}
sub(int x,int y,int z)
{
a=x;
b=y;
c=z;
e=a+c+b;
}
void display()
{
cout<<"the sum of numbers is :"< }
};
void main()
{
sub s1,s2(30,40),s3(10,20,30);
s1.display();
s2.display();
s3.display();
getch();
}




OUTPUT :

the sum of numbers is :101
the sum of numbers is :70
the sum of numbers is :60

1 comment:

Anonymous said...

1xbet korean Sportsbook Review (2021)
The most popular of sports 온카지노 are soccer, febcasino rugby, basketball and tennis. Sports betting is live in the online sports betting market. All in all, we 1xbet korean