SlideShare a Scribd company logo
operator overloading in C++
JUNAIDVK
junaidvkomy@gmail.com
www.facebook.com/junaid.omy
twitter.com/junaid.omy
in.linkedin.com/in/junaidvkomy
9745991390
OPERATOR OVERLOADING
Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
WHAT IS OPERATOR???
An operator is a symbol that
tells the compiler to perform
specific mathematical or logical
manipulations. Some operators
are….
• Arithmetical operators
• Logical operators
• Relational operators
OVERLOADING
More than one definition for
a function name or
an operator in the same scope,
which is called overloading.
• Function overloading
• Operator overloading
Operator overloading
The process of making an
operator to exhibit
different behaviours in
different instances is
known as operator
overloading.
Syntax:-
operator([parameters]) { Statements }
operator([parameters])
{
Statements
}
Benefits…..
• Perform different operations
on the same operands.
• It makes code much more
readable.
• Easily access the objects to
perform any operations .
Example
#include <iostream>
using namespace std;
class temp
{
private:
int count;
public:
temp()
{
count=25;
}
void operator --()
{
count--;
}
void Display()
{
cout<<"Count: "<<count;
}
};
main()
{
temp t;
--t;
t.Display();
}
OUTPUT
Count:24
Function overloading
Using a single function name to
perform different types of
tasks is known as function
overloading.
Example:
#include<iostream>
using namespace std;
class shape
{
public:
float area(double a)
{
float circle_area;
circle_area=3.14*(a*a);
return circle_area;
}
int area(int a)
{
int squire_area;
squire_area=a*a;
return squire_area;
}
int area(int a,int b)
{
int rectangle_area;
rectangle_area=a*b;
return rectangle_area;
}
};
main()
{
double circlee;
int squiree,rectanglee;
shape object;
cout<<"Area of Circle:";
circlee=object.area(5.00);
cout<<circlee;
cout<<"nArea of squire:";
squiree=object.area(4);
cout<<squiree;
cout<<"nArea of rectangle:";
rectanglee=object.area(5,6);
cout<<rectanglee;
}
Output:
Area of Circle:78.5
Area of squire:16
Area of rectangle:30
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Give a feedback @ massbaab.com/baabtra
Thanks in advance
www.baabtra.com | www.massbaab.com |www.baabte.com
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Cafit Square,
Hilite Business Park,
Near Pantheerankavu,
Kozhikode
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
Contact Us

More Related Content

PPT
Lec 26.27-operator overloading
PPTX
OPERATOR OVERLOADING IN C++
PPTX
Operator overloadng
PPTX
Operator overloading
PPTX
Operator overloading and type conversions
PPTX
Operator overloading
PPTX
Operator overloading
PPTX
Bca 2nd sem u-4 operator overloading
Lec 26.27-operator overloading
OPERATOR OVERLOADING IN C++
Operator overloadng
Operator overloading
Operator overloading and type conversions
Operator overloading
Operator overloading
Bca 2nd sem u-4 operator overloading

What's hot (20)

PDF
Operator overloading
PPTX
Operator overloading and type conversion in cpp
PPTX
Presentation on overloading
PPT
Operator overloading in C++
PPT
Operator overloading
PPT
08 c++ Operator Overloading.ppt
PPTX
Operator overloading
PPTX
Unary operator overloading
PPTX
#OOP_D_ITS - 5th - C++ Oop Operator Overloading
PDF
Operator_Overloaing_Type_Conversion_OOPC(C++)
PPTX
operator overloading
PPT
C++ overloading
PPT
14 operator overloading
PPTX
Operator overloading
PPT
Operator overloading
PPT
Operator Overloading
PPT
Operator overloading
PPT
Lecture5
PPTX
operator overloading & type conversion in cpp over view || c++
Operator overloading
Operator overloading and type conversion in cpp
Presentation on overloading
Operator overloading in C++
Operator overloading
08 c++ Operator Overloading.ppt
Operator overloading
Unary operator overloading
#OOP_D_ITS - 5th - C++ Oop Operator Overloading
Operator_Overloaing_Type_Conversion_OOPC(C++)
operator overloading
C++ overloading
14 operator overloading
Operator overloading
Operator overloading
Operator Overloading
Operator overloading
Lecture5
operator overloading & type conversion in cpp over view || c++
Ad

Similar to operator overloading in C++ (20)

PPTX
Operator Overloading & Function Overloading
PDF
Operator overloading C++
PPTX
Operator overloading (binary)
PDF
OOPS-Seminar.pdf
PPTX
operator overloading
PPTX
PPTX
B.sc CSIT 2nd semester C++ Unit4
PPTX
Cpp (C++)
PPTX
Operator Overloading
PPT
Operator overloading
PPTX
Operator Overloading
PPTX
OPERATING OVERLOADING IN VHDL
PPT
Binary operator overloading
PPT
Unary operator overloading
PPTX
Operator overloading
PPT
Polymorphism and function overloading_new.ppt
PPT
Operator Overloading
PPT
OperatorOverloading.ppt
PPTX
OOP Week 4 Lecture 1.pptx
PDF
Object Oriented Programming using C++ - Part 3
Operator Overloading & Function Overloading
Operator overloading C++
Operator overloading (binary)
OOPS-Seminar.pdf
operator overloading
B.sc CSIT 2nd semester C++ Unit4
Cpp (C++)
Operator Overloading
Operator overloading
Operator Overloading
OPERATING OVERLOADING IN VHDL
Binary operator overloading
Unary operator overloading
Operator overloading
Polymorphism and function overloading_new.ppt
Operator Overloading
OperatorOverloading.ppt
OOP Week 4 Lecture 1.pptx
Object Oriented Programming using C++ - Part 3
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
PDF
Acquiring new skills what you should know
PDF
Baabtra.com programming at school
PDF
99LMS for Enterprises - LMS that you will love
PPTX
Chapter 6 database normalisation
PPTX
Chapter 5 transactions and dcl statements
PPTX
Chapter 4 functions, views, indexing
PPTX
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
Chapter 1 introduction to sql server
PPTX
Chapter 1 introduction to sql server
Agile methodology and scrum development
Acquiring new skills what you should know
Baabtra.com programming at school
99LMS for Enterprises - LMS that you will love
Chapter 6 database normalisation
Chapter 5 transactions and dcl statements
Chapter 4 functions, views, indexing
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server

Recently uploaded (20)

PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Cloud computing and distributed systems.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Approach and Philosophy of On baking technology
Chapter 3 Spatial Domain Image Processing.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Dropbox Q2 2025 Financial Results & Investor Presentation
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Advanced methodologies resolving dimensionality complications for autism neur...
Cloud computing and distributed systems.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
Spectral efficient network and resource selection model in 5G networks
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Approach and Philosophy of On baking technology

operator overloading in C++

  • 3. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4. WHAT IS OPERATOR??? An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Some operators are…. • Arithmetical operators • Logical operators • Relational operators
  • 5. OVERLOADING More than one definition for a function name or an operator in the same scope, which is called overloading. • Function overloading • Operator overloading
  • 6. Operator overloading The process of making an operator to exhibit different behaviours in different instances is known as operator overloading. Syntax:- operator([parameters]) { Statements } operator([parameters]) { Statements }
  • 7. Benefits….. • Perform different operations on the same operands. • It makes code much more readable. • Easily access the objects to perform any operations .
  • 8. Example #include <iostream> using namespace std; class temp { private: int count; public: temp() { count=25; } void operator --() { count--; } void Display() { cout<<"Count: "<<count; } }; main() { temp t; --t; t.Display(); } OUTPUT Count:24
  • 9. Function overloading Using a single function name to perform different types of tasks is known as function overloading.
  • 10. Example: #include<iostream> using namespace std; class shape { public: float area(double a) { float circle_area; circle_area=3.14*(a*a); return circle_area; } int area(int a) { int squire_area; squire_area=a*a; return squire_area; } int area(int a,int b) { int rectangle_area; rectangle_area=a*b; return rectangle_area; } }; main() { double circlee; int squiree,rectanglee; shape object; cout<<"Area of Circle:"; circlee=object.area(5.00); cout<<circlee; cout<<"nArea of squire:"; squiree=object.area(4); cout<<squiree; cout<<"nArea of rectangle:"; rectanglee=object.area(5,6); cout<<rectanglee; } Output: Area of Circle:78.5 Area of squire:16 Area of rectangle:30
  • 11. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Give a feedback @ massbaab.com/baabtra Thanks in advance www.baabtra.com | www.massbaab.com |www.baabte.com
  • 12. Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Cafit Square, Hilite Business Park, Near Pantheerankavu, Kozhikode Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com Contact Us