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.


Which of the following is NOT defined as a friend function in the Integer class?

  1. operator+()

  2. operator-()

  3. operator%()

  4. operator++()

The correct answer is: operator++()

A friend function in the Integer class is a function that is external to the class but has access to its private members. This allows the function to operate on an object of the Integer class as if it were a member of the class. In this case, all of the options listed are defined as friend functions in the Integer class except for operator++(), which is defined as a member function. The other options are incorrect because they are either not defined as functions in the Integer class or they are not declared as friends of the class. Therefore, D is the correct answer as it is the only option that is not defined as a friend function in the Integer class.