Question on C++ Practice 65.2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Question on C++ Practice 65.2

I have a question on the C++ practice on operator overloading. Question in code. Thank you :) https://code.sololearn.com/cq1QC37i0myi/?ref=app

31st Dec 2022, 10:50 AM
Interesting
Interesting - avatar
2 Answers
+ 1
In the first case, you defined a default object k without a parameter, (argument), on the type of the Account() {} class, which means you cannot use Account(int a): balance(a) { interest += balance/10; }, and therefore you need to make these calculations yourself.
31st Dec 2022, 2:10 PM
Solo
Solo - avatar
+ 2
by first approach, you are not calculating interest value. But 2nd calculating by constructor...
31st Dec 2022, 11:32 AM
Jayakrishna 🇮🇳