What is Operator Overloading?

Operator overloading is a technique in which an operator is used for performing multiple related operations. All the operators perform operations upon predefined data types of the C++, so in order to overload the operators these are used with the objects of class. Operator overloading implements compile time polymorphism in C++ as it performs multiple operations using a single operator.
Syntax of operator overloading:
Return_type operator# (arguments)
{
}
In the above syntax, return type is the type of value this function returns. Operator is a keyword which is used in operator overloading. # is the operator which we want to overload. Arguments are the objects passed to this function.

More Questions

Leave a Reply

Word Verfication * Time limit is exhausted. Please reload CAPTCHA.