0% found this document useful (0 votes)
22 views11 pages

Object Oriented Programming Language

The document discusses operator overloading in object oriented programming languages. Operator overloading allows operators to perform different operations on user-defined data types by declaring special member functions. Common operators that can be overloaded include arithmetic, increment, concatenation, and comparison operators. The assignment operator can also be overloaded.

Uploaded by

Usama zahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views11 pages

Object Oriented Programming Language

The document discusses operator overloading in object oriented programming languages. Operator overloading allows operators to perform different operations on user-defined data types by declaring special member functions. Common operators that can be overloaded include arithmetic, increment, concatenation, and comparison operators. The assignment operator can also be overloaded.

Uploaded by

Usama zahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Object oriented programming language

SAADIA BANO
Lecturer
[email protected]
COMSATS Institute of Information Technology
Department of Computer Science,
Sahiwal
Operator overloading

 Process of defining additional meaning of operators


 Enable an operator to perform different operations and to process user
defined data type
 Basic arithmetic operations (+,-,/,*) are already defined in the language
 An operator can be overloaded by declaring special member function in the
class
 It uses the keyword operator with the symbol
Cont.

Return_type operator op ()
{
Function body;
}

Example:
Void operator ++()
{
Function body;
}
Overloading unary operators

 A type of operator that works with single operand


 The operators(+,-,*,/) are overloaded to increase their capabilities
Example:
Operator overloading with returned
value
Example:
Overloading postfix increment operator
Concatenate two strings
Comparison operator
Overloading assignment operator

You might also like