I've read about 6 tutorials on this but for some reason it makes no sense to me. Could someone possibly work with me to help me understand this concept? Such as how would you overload something like this: int result = 2 + 5;
neoseeker191
0
Light Poster
Recommended Answers
Jump to PostThat really is a poor example because that just works already.
Google operator overloading fractions /complex numbers
As these are the most frequently used.
Jump to PostThere isn't anything really special about operator overloading...
In fact the same functionality can be achieved using named functions if it helps to clarify matters.
I like to think of overloading as syntax candy.
for example you can do:
Fraction a; Fraction b; a.addFraction(b); instead of explicitly …
Jump to PostBasically, instead of writing the function addFraction and then calling it a.addFraction(b), where a and b are Fraction objects for example a could be 1/2 and b might be 1/3.
You just write:
a + b and it does the same thing.
As long as you define …
All 9 Replies
iamthwee
neoseeker191
0
Light Poster
iamthwee
neoseeker191
0
Light Poster
iamthwee
neoseeker191
0
Light Poster
iamthwee
neoseeker191
0
Light Poster
neoseeker191
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.