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 returned by the prefix increment operator when overloaded as a member function?

  1. A copy of the incremented value

  2. The original value before incrementing

  3. A reference to the incremented value

  4. A pointer to the incremented value

The correct answer is: A reference to the incremented value

When the prefix increment operator is overloaded as a member function, it is called on an object and modifies the value of that object, so it returns a reference to the incremented value. Option A is incorrect because it returns a copy of the incremented value, not the original value itself. Option B is incorrect because it does not modify the original value. Option D is incorrect because the prefix operator returns a value, not a pointer to that value.