[solved]What's the mistake in this program ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[solved]What's the mistake in this program ??

Program to overload + operator https://code.sololearn.com/ca18PGKBn23e/?ref=app

27th Nov 2017, 3:38 AM
Rishabh
Rishabh - avatar
14 Answers
+ 3
I altered it. all the best on the exams. the lack of address in overload and const the lack of getter (to get private values) https://code.sololearn.com/cx3kuuMj70tl/?ref=app
27th Nov 2017, 5:16 AM
Manual
Manual - avatar
+ 3
what values of the two objects where being added?
27th Nov 2017, 3:46 AM
Manual
Manual - avatar
27th Nov 2017, 5:19 AM
Manual
Manual - avatar
+ 2
private int value; Void setData(int v){ value = v; } int main(){ obj2.setData(obj.getData()+obj1.getData()); //something like that hope it helps }
27th Nov 2017, 3:51 AM
Manual
Manual - avatar
+ 2
So when is your homework due?
27th Nov 2017, 4:19 AM
Manual
Manual - avatar
+ 1
@manual I didn't understood wht u wanna say ??
27th Nov 2017, 3:46 AM
Rishabh
Rishabh - avatar
+ 1
both a & b values from obj and obj1 are added !! AS IN COMPLEX NUMBERS
27th Nov 2017, 3:48 AM
Rishabh
Rishabh - avatar
+ 1
@manual Yeah it's another way to solve the problem but...I don't wanna change the program ...there's little mistake in the program but I'm unable to identify that, hope u understand I think your soln is little more complicated then the above program !!
27th Nov 2017, 3:55 AM
Rishabh
Rishabh - avatar
+ 1
@manual don't worry I understood the basic concepts behind operator overloading I can write my exams ... effectively
27th Nov 2017, 4:24 AM
Rishabh
Rishabh - avatar
+ 1
Awesome that's the thing which I wanted !!
27th Nov 2017, 5:20 AM
Rishabh
Rishabh - avatar
27th Nov 2017, 5:41 AM
Rishabh
Rishabh - avatar
0
@manual it's for my exams ... I have to understand operator overloading I have my C++ exams tomorrow!!
27th Nov 2017, 4:20 AM
Rishabh
Rishabh - avatar
0
Well I cannot help you more than your prof. Try a video or an other user may be able to help you.
27th Nov 2017, 4:29 AM
Manual
Manual - avatar
- 1
@thanks a lot manual you've tried your best !!
27th Nov 2017, 4:29 AM
Rishabh
Rishabh - avatar