C++ operator overloading
C++ operator overloading
Operator Overloading:
• Operator overloading is a compile-time polymorphism in which the operator is
overloaded to provide the special meaning to the user-defined data type.
Operator overloading is used to overload or redefines most of the operators
available in C++.
• C++ has the ability to provide the operators with a special meaning for a data
type, this ability is known as operator overloading. Operator overloading is a
compile-time polymorphism. For example, we can overload an operator ‘+’ in a
class like String so that we can concatenate two strings by just using +.
Operator Overloading Syntax
Where the return type is the type of value returned by the function.
class_name is the name of the class.
OperatorSymbol is an operator function where Symbol is the operator being
overloaded, and the operator is the keyword.
return (c3);
}