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 keyword is used in C++ to declare a function to support late binding?

  1. virtual

  2. dynamic

  3. late

  4. override

The correct answer is: virtual

In C++, the keyword "virtual" is used to declare a function that supports late binding. This means that the function can be overridden by a derived class and the binding will occur at runtime instead of at compile time. Options B and C are incorrect because they are not valid keywords in C++. Option D, "override", is a valid keyword in C++ but it is used to explicitly indicate that a virtual function is being overridden. It is not the keyword used to declare a function as virtual.