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
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
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
What type of communications is the SIMPLE protocol designed to secure?
A. IM and presence information B. email C. FTP D. HTTP
?_____ 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Â