Networking, Programming and Graphics Tutorials

Operator overloading - C++ [1/1]

Type:
Operator overloading - C++
Level: Intermediate Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
Operator overloading - C++
Date: 2006-Dec-08
Operator overloading - C++
Visited: 1947 times
Operator overloading - C++
Rating: Operator overloading - C++
Operator overloading - C++
Author: Alex Plumpton

Operator overloading is the process by which already existing operators like +,-,= etc are given different meanings. For example, the arithmetic operator +, which adds two numbers can be used to add two objects. That is, the + operator can act on the abstract data types in the same way as on the built-in data types. Thus the + operator is overloaded with a different meaning besides the existing meaning. When an operator is overloaded, the original meaning is not lost.

1. Process by which existing operators are given different meanings.
2. Operators made to act on abstract data types in same way as on built-in data types original meaning not lost on overloading the operator.
3. Operators which cannot be overloaded are:
- scope resolution operator
- new
- size of
- conditional operator (?:)
- class member operator (.")

Operator overloading - C++
The meaning of the operator in relationship with class needs to be specified. The general syntax of an operator function is as shown. Here, return type is the type of value returned by the function. Op is the operator which is to be overloaded. Operator op is the function name. Operator function should either be member function or friend function.

Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Operator overloading - C++ [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: explain about operator overloading and function overloading with examples  difference in function overloading and operator overloading in c++?  overloading the == operator in c++  overloading * operator in c++  overloading c++ -operator  c++ overloading -operator  overloading C++ -operator  c++ overloading ++ -operator  use of operator overloading in c++  operator overloading in c++  What is operator overloading in C++  what is the need of operator overloading in c++?  operator overloading [] in c++  function name and operator overloading in C++  c++ overloading -operator signature  c++ overloading binary * operator  Overloading binary operator >  operator overloading C++ linux  operator overloading in c++ programs  c++ overloading function operator