Only existing can be overloaded. New operators can not be created.
The overloaded operator must have at least one operand that is user defined type.
We can not change the basic meaning of operator.
Overloaded operator follows the syntax rules of the original operators. They can not be overridden
There are some operators which can not be overloaded such as
Sizeof----------->Size of Operator
----------->Membership Operator
------------>Scope Resolution Operator
------------>Conditional Operator
We can use friend function to overload operators
Unary operators overloaded means of member function take no explicit argument and return no explicit value.
Binary operators overloaded through a member function take one explicit argument.
When binary operators overloaded through member function then left hand operand must be object of relevant class.
The overloaded operator must have at least one operand that is user defined type.
We can not change the basic meaning of operator.
Overloaded operator follows the syntax rules of the original operators. They can not be overridden
There are some operators which can not be overloaded such as
Sizeof----------->Size of Operator
----------->Membership Operator
------------>Scope Resolution Operator
------------>Conditional Operator
We can use friend function to overload operators
Unary operators overloaded means of member function take no explicit argument and return no explicit value.
Binary operators overloaded through a member function take one explicit argument.
When binary operators overloaded through member function then left hand operand must be object of relevant class.
0 Comments:
Post a Comment