Chapter 13: Problem 8
Consider the following statements: class yClass class xClass: public yClass { { public: public: void one(); void one(); void two(int, int); xClass(); yClass(); private: private: int z; int a; int b; }; }; Suppose the following statements are in a user program (client code): 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 << endl; } ii. y.a = 15; x.b = 30; iii. void xClass::one() { a = 10; b = 15; z = 30; cout << a + b + z << endl; } iv. cout << y.a << " " << y.b << " " << x.z << endl;
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.