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

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

Prepare for the ultimate C++ challenge with our comprehensive quiz based on 'Thinking in C++'. Test your knowledge with engaging questions and receive instant feedback. Perfect for both beginners and experienced C++ programmers looking to sharpen their skills!

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.