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...
When setting up a new Linux server that will require files larger than 2 TB in size, which of the following file system types should be used?
A. NTFS B. ext2 C. ext4 D. FAT32
Computer Science & Information Technology
Why is the efficiency of an algorithm important?
What will be an ideal response?
Computer Science & Information Technology