Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Consider the following statements: class yClass { public: void one(); void two(int, int); yClass(); private: int a; int b; }; class xClass: public yClass

3. 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 << 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;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

help asp

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago