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 function print 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;
}


Answer: D

Computer Science & Information Technology

You might also like to view...

In an array implementation of a stack, we can include code that will automatically allocate more memory if every element of the array is occupied. Which stack operation should invoke this code?

a) push b) pop c) peek d) poke e) none of the above

Computer Science & Information Technology

Email is a convenient way to send information to multiple people simultaneously.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

________ code is not modified as it executes and may be shared by several processes simultaneously.

a) Preemptible b) Dynamic c) Reentrant d) Serially reusable

Computer Science & Information Technology

Which of the following devices uses one or more pens to draw an image on a roll of paper?

A) Stylus B) Thermal printer C) Plotter D) Dye-sublimation printer

Computer Science & Information Technology