logo codesdope

Can anyone provide me notes of operator overloading...Please

   asas


Answers

  •    Tannishtha Sengupta , BPPIMT

    Operator overloading is a compile-time polymorphism in which the operator is overloaded to provide the special meaning to the user-defined data type.  Operator overloading is used to overload or redefines most of the operators available in C++. It is used to perform the operation on the user-defined data type.

    Operator that cannot be overloaded are as follows: Scope operator (::) Sizeof member selector(.) member pointer selector(*) ternary operator(?:)

    Rules for Operator Overloading

    Existing operators can only be overloaded, but the new operators cannot be overloaded. The overloaded operator contains at least one operand of the user-defined data type. We cannot use friend function to overload certain operators. However, the member function can be used to overload those operators. When unary operators are overloaded through a member function take no explicit arguments, but, if they are overloaded by a friend function, takes one argument. When binary operators are overloaded through a member function takes one explicit argument, and if they are overloaded through a friend function takes two explicit arguments.

     



Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.