Consider the following class definitions:class bClass{public:void setX(int a);//Postcondition: x = a;void print() const;private:int x;};class dClass: public bClass{public:void setXY(int a, int b);//Postcondition: x = a; y = b;void print() const;private:int y;};Which of the following correctly sets the values of x and y?

A. void dClass::setXY(int a, int b)
{
bClass::setX(a);
y = b;
}
B. void dClass::setXY(int a, int b)
{
x = a;
y = b;
}
C. void dClass::setXY(int a, int b)
{
x = bClass::setX(a);
y = bClass::setY(b);
}
D. void dClass::setXY(int a, int b)
{
x = bClass.setX(a);
b = y;
}


Answer: A

Computer Science & Information Technology

You might also like to view...

A computer system is a collection of unrelated components that work independently of one another

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following methods can be used to retrieves the first element stored in an array?

A. first B. @ C. in D. None of the above

Computer Science & Information Technology

What type of communications is the SIMPLE protocol designed to secure?

A. IM and presence information B. email C. FTP D. HTTP

Computer Science & Information Technology

?_____ describe what objects need to know about each other, how objects respond to changes in other objects, and the effects of membership in classes, superclasses, and subclasses.

A. ?Instances B. ?Relationships C. ?Aggregates  D. ?Clusters 

Computer Science & Information Technology