Exam 15: Polymorphism and Virtual Functions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

If the override specifier is added to the end of a member function declaration,what happens if the function is not specified as virtual in the parent class?

(Multiple Choice)
4.8/5
(35)

The virtual function mechanism binds the "right" function to objects.

(True/False)
4.8/5
(44)

It is useful to define a class for which no objects may be defined.

(True/False)
4.9/5
(43)

Why do you not get an undefined reference in virtual table error when you don't define a pure virtual function?

(Essay)
4.7/5
(43)

Explain the difference between virtual functions,late binding,and polymorphism.

(Essay)
4.9/5
(31)

Virtual functions allow old code to call new code.

(True/False)
4.8/5
(38)

Is there an error? class B { public: void virtual f(); }; void B::f(){/*...*/}

(Essay)
4.9/5
(30)

This is legal code. class B { public: // ... virtual void f()= 0; }; int main(){ B b1,b2;/*...*/ }

(True/False)
4.7/5
(38)

In C++,a virtual destructor is invoked whenever a virtual constructor was used to create the object.

(True/False)
4.8/5
(37)

Give some simple recommendation for when a destructor should be declared virtual.

(Essay)
4.8/5
(32)

Destructors are automatically virtual.

(True/False)
4.9/5
(35)

What is the error? class B { public: virtual void f(); }; virtual void B::f(){/*...*/}

(Essay)
4.8/5
(31)

The base class destructor must be virtual.

(True/False)
4.8/5
(39)

In a class,functions declared with the virtual keyword need not be defined.

(True/False)
4.8/5
(38)
Showing 21 - 34 of 34
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)