Why my code is not working? (i know it is nonsense) Help me please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why my code is not working? (i know it is nonsense) Help me please

https://code.sololearn.com/cNNSGT82v4Hy/?ref=app

6th Apr 2020, 6:30 PM
Денис Лапшин
Денис  Лапшин - avatar
2 Answers
+ 3
Use number = 10; not Number(10); Your just constructing another Number within your constructor and discarding it immediately. Take a look at the constructor initializer list for a more efficient way to initialize your variables in a constructor: https://en.cppreference.com/w/cpp/language/initializer_list
6th Apr 2020, 7:11 PM
Dennis
Dennis - avatar
0
thanks a lot
6th Apr 2020, 10:49 PM
Денис Лапшин
Денис  Лапшин - avatar