Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Problem Solving with C++ Study Set 1
Quiz 15: Inheritance
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Question 41
Multiple Choice
If a base class has a virtual function named print, and a pointer variable of that class is pointing to a derived object, then the code ptr->print ) ; calls
Question 42
Multiple Choice
If you have a copy constructor in the base class, but do not have a copy constructor for the derived class, then
Question 43
Multiple Choice
If a base class has a non-virtual member function named print, and a pointer variable of that class is pointing to a derived object, then the code ptr->print ) ; calls
Question 44
Multiple Choice
If a derived class Class2) has redefined a function from the base class Class 1) , how can that derived function call the base class function if the function declaration is as follows? Void print ) ;
Question 45
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) ;
Question 46
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) ;
Question 47
Multiple Choice
Given a class A that derives from a class B that derives from a class C, when an object of class A goes out of scope, in which order are the destructors called?
Question 48
Multiple Choice
Which of the following would correctly call the base class BaseClass) assignment operator from the derived class DerivedClass) assignment operator? DerivedClass& DerivedClass::operator =const DerivedClass& rightSide) { //what goes here? }