Assume the declaration of Exercise.
a. Write the definition of the default constructor of yClass so that the private data members of yClass are initialized to 0 .
b. Write the definition of the default constructor of xClass so that the private data members of xClass are initialized to 0 .
c. Write the definition of the member function two of yClass so that the private data member a is initialized to the value of the first parameter of two, and the private data member b is initialized to the value of the second parameter of two .
Exercise
Consider the following statements:
class yClass{public:void one( );void two(int, int);yClass ( );private:int a;int b;};class xClass: public yClass{public:void one ( );xClass ( );private:int z;};yClass y;xClass x;a. The private members of yClass are public members of xClass . True or False?
b. Mark the following statements as valid or invalid. If a statement is invalid, explain why.
i.
void yClass::one ( ){cout ≪ a + b ≪ end1;}ii.
y.a = 15;x.b = 30;
iii.
void xClass::one ( ){a = 10;b = 15;z = 30;cout ≪ a + b + z ≪ end1;}iv.
cout ≪ y.a ≪ “ ” ≪ y.b ≪ “ ” ≪ x.z ≪ end1;
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.