Why this doesnt work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why this doesnt work?

I really dont understand why it didnt work?someone who knows the ansswer help me https://code.sololearn.com/WPnsfbcG6Bhr/?ref=app

11th Nov 2019, 8:04 AM
durian
durian - avatar
1 Answer
+ 3
You are calling the constructor first and then you are taking values from user. When you call constructor initially, it is passing values in a and b which at that moment is undefined. Therefore, the values in output is undefined. Take the values from user before calling constructor, your program will run fine then.
11th Nov 2019, 8:31 AM
Chetali Shah
Chetali Shah - avatar