Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++'

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What is NOT true about the 'virtual' keyword in C++?

  1. It forces a function to be implemented in derived classes

  2. It enables late binding for the function

  3. It is only required in the base class declaration

  4. Derived class functions matching the base class declaration are treated as virtual

The correct answer is: It forces a function to be implemented in derived classes

Using the 'virtual' keyword in C++ does not force a function to be implemented in derived classes. Instead, it allows for dynamic binding at run-time and enables polymorphism. Option B is incorrect because the 'virtual' keyword does enable late binding. Option C is incorrect because the 'virtual' keyword is required in both the base class declaration and the derived class declaration. Option D is incorrect because the function in the derived class must also be declared as 'virtual' to be treated as such.