Solved

Given the Following Classes and Code, What Is the Output

Question 42

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

verifed

Verified

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

Related Questions