Friday, May 1, 2009

OPERATOR OVERLOADING

Operator Overloading

Operator overloading is one of the features of C++ language. It is an important technique that has enhanced the power of extensibility of C++. C++ permits us to add two variable user-defined types with the same syntax that is applied to the basic types. This means that C++ has the ability to provide the operator with a special meaning for a data type. The mechanism of giving such special meanings to an operator is known as operator overloading.

We can overload (give additional meaning to) all the C++ operators except the following.

  • Class member access operator(., .*).
  • Scope resolution operator ( :: ).
  • Size Operator(sizeof).
  • Conditional operator (?:).

The excluded operators are very few when compared to the large number of operators which qualify for the operator



No comments:

Post a Comment