Saturday, 2 October 2010

RULES FOR OPERATOR OVERLOADING



RULES FOR OPERATOR OVERLOADING:

1.      New operators cannot be created. Trying to overload a new operator will produce compile time errors.
2.      Meaning of the existing operators cannot be changed.
3.      Number of arguments that an existing operator takes cannot be changed.
4.      Overloading operators cannot take default arguments.
5.      Some of the existing operators cannot be overloaded.
Scope resolution operator (::),
Member Selection operator  (.)
Member Selection through pointer to member (.*)
Conditional operator (?:)
Sizeof operator ( sizeof)
Typeid operator (typeid)
6.      Some of the operators can be overloaded using non-static member functions only.
Assignment operator (=)
Function operator (())
Subscripting operator ([ ])
Pointer to member access operator (à



friend function

No comments:

Post a Comment