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.


How does the compiler treat a function defined inside a class body?

  1. As a virtual function.

  2. As an inline function.

  3. As a private function.

  4. As a static function.

The correct answer is: As an inline function.

A function defined inside a class body is automatically considered inline unless explicitly declared as virtual, private, or static. Therefore, options A, C, and D are incorrect. Option A is incorrect because a function inside a class body is not automatically considered virtual. Option C is incorrect because there is no explicit access modifier mentioned. Option D is incorrect because a static function is not automatically defined inside a class body.