Lab 12
Lab 12
Types of operators:
There are two types of operator overloading:
1. Unary operator overloading
2. Binary operator overloading
Introduction to C++ Operator Overloading:
In C++, we can define how operators behave for user-defined types like class and structures For
example,
The + operator, when used with values of type int, returns their sum. However, when used with
objects of a user-defined type, it is an error.
In this case, we can define the behavior of the + operator to work with objects as well.
This concept of defining operators to work with objects and structure variables is known as
operator overloading.
Task #05:
Write a C++ code to Overloading Extraction and Insertion Operators?