Multiple Choice
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=new Dog;
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
Correct Answer:

Verified
Correct Answer:
Verified
Q4: Polymorphism refers to<br>A) the ability to assign
Q5: Given a class A that derives from
Q6: A base class may have at most
Q7: If a derived class Class2) has redefined
Q8: If the member variables of the base
Q10: The ability to associate multiple meanings to
Q11: If the member variables in a base
Q12: If you use the keyword virtual in
Q13: The base class has everything that is
Q14: What is another name for a child