Perfect set of operators that can’t be overloaded in CPP - Operator Overloading

Q.  Which of the following is the perfect set of operators that can’t be overloaded in CPP ?
- Published on 17 Jul 15

a. +=, ?, :: , >>
b. >>, <<, ?, *, sizeof()
c. :: , . , .* , ?:
d. :: , ->, * , new, delete

ANSWER: :: , . , .* , ?:
 

    Discussion

  • Ramesh   -Posted on 23 Oct 15
    In C++ we cannot overload these operators :: , . , .* , ?: . sizeof is also called an operator, and it can't be overloaded.
    Most of the operators In C++, you can overload so that they perform special operations relative to classes that you create
    General form of a member operator function is as follows.
    ret-type class-name::operator operatorSign (arg-list)
    {
    // operations
    }

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)