Thursday, 30 January 2020

Operator Overloading

0 comments

Operator Overloading


? In this unit, we have seen how the normal C++ operators can be given new meanings
when applied to user-defined data types.
? The keyword operator is used to overload an operator, and the resulting operator will
adopt the meaning supplied by the programmer.
? Closely related to operator overloading is the issue of type conversion. Some conversions
take place between user defined types and basic types.
Object-oriented Programming
Notes ? Two approaches are used in such conversion: A one argument constructor changes a basic
type to a user defined type, and a conversion operator converts a user-defined type to a
basic type.
? When one user-defined type is converted to another, either approach can be used.


Operator Overloading: Attaching additional meaning and semantics to an operator. It enables
to exhibit more than one operations polymorphically.
Strings: The C++ strings library provides the definitions of the basic string class, which is a class
template specifically designed to manipulate strings of characters of any character type.
Unary Operators: Unary operators operate on one operand (variable or constant). There are two
types of unary operators- increment and decrement.

No comments:

Post a comment