题目内容

Which of the following operators should be preferred to overloaded as a global function rather than a member function?

A. postfix++
B. comparison operator
C. insertion operator << (or extraction operator >>)
D. prefix ++

查看答案
更多问题

How does C++ compiler differ between overloaded postfix and prefix unary operators?

A. C++ does not allow both operators to be overloaded in a class.
B. A postfix ++ has a dummy parameter
C. A prefix ++ has a dummy parameter
D. By making prefix ++ as a global function and postfix as a member function

Which of the following operator functions cannot be global, i.e., must be a member function?

A. new
B. delete
C. conversion operator
D. All of the above

Which of the following operator functions cannot be global, i.e., must be a member function?

A. ()
B. []
C. =
D. all of the above

Binary operators can be overloaded as non-member functions, but unary operators can only be overloaded as member functions.

A. 对
B. 错

答案查题题库