Question: Consider the following class definitions: In _ _ _ _ the same expression is used to denote different operations. Group of answer choices Inheritance Encapsulation

Consider the following class definitions:
In ____ the same expression is used to denote different operations.
Group of answer choices
Inheritance
Encapsulation
Polymorphism
Composition
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?
Group of answer choices
void dClass::setXY(int a, int b)
{
bClass::setX(a);
y = b;
}
void dClass::setXY(int a, int b)
{
x = a;
y = b;
}
void dClass::setXY(int a, int b)
{
x = bClass::setX(a);
y = bClass::setY(b);
}
void dClass::setXY(int a, int b)
{
x = bClass.setX(a);
b = y;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!