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.


Can C++ overload functions based on their return type alone?

  1. Yes, always

  2. No, never

  3. Only if the function has arguments

  4. Only in templates

The correct answer is: No, never

C++ cannot overload functions based on their return type alone. Overloading functions requires that they have different parameters, not simply different return types. This means that options A and C, which suggest that overloading based on return type is sometimes possible, are incorrect. Option D is not correct because templates involve type parameters rather than return type parameters, and therefore cannot be used to overload based on return type.