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 happens if you try to make an object of an abstract class?

  1. The compiler prevents it

  2. The object is made with default values

  3. The object is created successfully

  4. Run-time error occurs

The correct answer is: The compiler prevents it

An abstract class cannot be instantiated, so attempting to create an object of an abstract class will result in a compilation error. This is because an abstract class is incomplete and contains abstract methods that must be implemented in a subclass. Option B and C are incorrect as there is no default behavior for making an object of an abstract class and it cannot be created successfully. Option D is incorrect as a run-time error only occurs when the code is running, but in this case, the error would be caught by the compiler.