2. KEY CONCEPTS
OVERLOADING
OPERATOR FUNCTIONS
OVERLOADING UNARY OPERATORS
STRING MANIPULATIONS
BASIC TO CLASS TYPE
CLASS TO CLASS TYPE
OPERATOR OVERLOADING
OVERLOADING BINARY OPERATORS
USING FRIENDS FOR OVERLOADING
TYPE CONVERSIONS
CLASS TO BASIC TYPE
OVERLOADING RULES
3. SUMMARY
Operator overloading is one of the important features of C++ language that
enhances its exhaustibility.
Using overloading feature we can add two user defined data types such as
objects , with the same syntax , just as basic data types.
We can overload all the C++ operators except the following:
• Scope resolution operator(::)
• Class member access operator(.,.*)
• Size operator (sizeof)
• Conditional operator(?:)
Operator overloading is done with the help of special function , called
operator function ,which describes the special task to an operator
4. SUMMARY CONTD
There are certain restrictions and limitations in overloading operators.
Operator functions must either be member-functions(nonstatic) or friend
functions. The overloading operator must have at least one operand that is of
user-defined type.
The compiler does not support automatic type conversions for the user-
defined data types. We can use casting operator to achieve this.
The casting operator function should satisfy the following conditions:
• It must be a class member
• It must not specify a return type
• It must not have any arguments