If you have the following class definitions, which of the following is the proper way to construct an object of the derived class?
Class Pet
{
Public:
Pet) ;
Void printPet) ;
String getName) ;
Void setNamestring newName) ;
Private:
String name;
};
Class Dog:public Pet
{
Public:
Dog) ;
Void printPet) ;
Void setTypestring newType) ;
String getType) ;
Private:
String type;
};
A) Dog::Dog) :Pet) ,type"MUTT") {
}
B) Dog::Dog) {
Name="Rover";
}
C) Pet::Dog) :Pet) ,type"MUTT") {
}
D) Dog::Pet) :Pet) ,type"MUTT") {
}
Correct Answer:
Verified
Q29: Which of the following are not true
A)
Q30: C++ implements polymorphism by waiting until run-time
Q31: Using virtual functions is also known as
Q32: A base class pointer variable can point
Q33: Give a base class with at least
Q35: Which of the following are true?
A) constructors
Q36: If a base class has a public
Q37: Using inheritance allows us to
A) eliminate duplicate
Q38: When deriving a class, you should
A) list
Q39: Another name for the base class is
A)
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents