0
about constructor parameter
Class My_class{ private: Int k } \*If i declare a constructor with a parameter to input*\ My_class(int r){ k=r } \*Then, what if I create an object without entering the parameter*\ My_class obj
3 Antworten
+ 2
Compile error happens. No matching call for constructor with 0 parameters
0
Thank you
0
To prevent compile error, you can either do a parameter with a default value, or add a constructor with no parameter