Given the following classes and code, what is the output of the last statement shown?
class Pet
{
public:
virtual void print();
string name;
private:
};
class Dog: public Pet
{
public:
void print();
string breed;
};
void Pet::print()
{
cout << "My name is " << name;
}
void Dog::print()
{
Pet::print();
cout << ", and my breed is a "<< breed << endl;
}
Pet pPtr;
Dog dPtr;
dPtr->name= "Rover";
dPtr->breed="Weiner";
pPtr= dPtr;
pPtr->print();
a. My name is Rover, and my breed is a Weiner
b. My name is Rover
c. , and my breed is a Weiner
d. nothing
b. My name is Rover
You might also like to view...
Clicking on the row selector box selects an entire ________ in a data source
Fill in the blank(s) with correct word
The condition known as __________ occurs when you try to store an integer that is bigger than the maximum allowed by the number of bits you have.
Fill in the blank(s) with correct word