How to overload the conditional operator? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Operator overloading I was wonder how can I over load the Conditional operator in cpp? int a,b,c; a=10; b=11; c = (a>b) ? a : b; Is it possible? 回答1: Several operators cannot be overloaded. These operators take a name, rather than an object, as their right operand: Direct member access (.) Deference pointer to class member (.*) Scope resolution (::) Size of (sizeof) The conditional operator (?:) also cannot be