+ 1
Why my code is not working? (i know it is nonsense) Help me please
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
0
thanks a lot