1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Schach [20]
3 years ago
6

Explain by details operator overloading in C++ with example

Computers and Technology
1 answer:
dimaraw [331]3 years ago
8 0

Answer:

Operator overloading is used to extend the functionality of an operator like +(addition),-(subtraction),/(Division),*(Multiplication).

Syntax for operator overloading inside the class :-

You have to use operator keyword.

Function

return type operator <operator sign> (arguments)

{

     ---code

}

suppose you want to extend the functionality of ++ operator for any integer so that it increases the value by two.

void operator ++(int &a)

{

    a=a+2;

}

So whenever this operator is used with an argument it will increase the value to that argument by 2.

int a=5;

++(a);

a will become 7;

You might be interested in
Alice is adding a chart in a spreadsheet. Which option will allow you her to give the chart a suitable title and subtitle?
Anon25 [30]

Chart elements is the answer.


8 0
3 years ago
Read 2 more answers
Lucy is completing a project as part of a science class using materials she found online. Which of the following is MOST LIKELY
const2013 [10]

Answer:

D.

Explanation:

Most students would fail to realize that the pictures they use also need citations so that would be the MOST LIKELY to lead to legal consequence.

7 0
3 years ago
Marcus creates a HTML webpage on his favourite game, football. On clicking the word “football” another website containing the in
shtirl [24]
I can’t see the following tags that he could’ve possibly used
3 0
3 years ago
WILL UPVOTE ALL plz
OverLord2011 [107]
D-ash is the answer.
8 0
3 years ago
Which of the following file formats is used for art work
Dovator [93]
JPEG. It's most used for art. And PNG is used mostly in websites because it is non-lose compression.
4 0
3 years ago
Other questions:
  • Which button limits your search to the files and folders in your storage locations on the device being search?
    11·1 answer
  • What type of scientists studies tree rings to determine the history of an area?
    9·2 answers
  • Write a function in MATLAB that takes as an input a matrix of coefficients for a system of linear equations (A), the solution ve
    15·1 answer
  • A _____ is made up of rows and columns and is used to organize information.
    12·2 answers
  • Sally is editing her science report about living things. She needs to copy a paragraph from her original report.
    13·1 answer
  • Dad Mystery
    9·2 answers
  • Anyone use zoom<br><br>code:- 2574030731<br>pass:- HELLO<br>Z●●M ​
    14·2 answers
  • Who made the game Monopoly???
    10·2 answers
  • Explain why you would use the soft on/off jumper when working on ATX system
    14·1 answer
  • Find the name of the professor with the maximum percentage of students that failed his course.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!