Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following class definitions: class bClass { public: void setX(int);

ID: 665274 • Letter: C

Question

Consider the following class definitions:

class bClass

{

public:

void setX(int);

void print() const;

private:

int x;

};

class dClass: public bClass

{

public:

void setXY(int, int);

void print() const;

private:

int y;

};

Which of the following statements correctly redefines the member functionprint of bClass?

a. void dClass::print() const {

   dClass:print();

   cout << " " << y << endl;

   }

b. void dClass::print() const {

   cout << x << " " << y << endl;

   }

c. void bClass::print() const {

   cout << x << " " << y << endl;

   }

d. void dClass::print() const {

   bClass::print();

   cout << "y = " << y << endl;

   }

Explanation / Answer

d. void dClass::print() const {
bClass::print();
cout << "y = " << y << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote