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:

Verified
Correct Answer:
Verified
Q2: The preprocessor directive _ is used to
Q7: Which of the following class definitions makes
Q12: Which of the following statements about inheritance
Q24: C++ provides _ functions as a means
Q35: If inheritance is private, all members of
Q38: The term _ is used to describe
Q40: In the case of composition,the _ name
Q42: To define new classes in C++,you create
Q43: What is the output of the
Q44: In _ polymorphism,the (data)type is left unspecified