Solved

Consider the Following Class Definitions: Class BClass

Question 39

Multiple Choice

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

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions