No appropriate default construtor available (C++) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

No appropriate default construtor available (C++)

this error occurs when I try to enter some integer values by using the (cin>>) operator in the constructor function ... how can I fix it ?! (write a simple code for example please)

21st Apr 2018, 2:24 PM
Mohamed Ahmed
Mohamed Ahmed - avatar
2 Answers
+ 1
Hello MoHaMeD AhMeD . Once you put parameters into the constructor, you HAVE to make sure that you have a default constructor when you create objects without parameters. In other words, you can not create an object like this Obj obj; If you don't have a default constructor, which in this case would be: Obj() {};
21st Apr 2018, 2:45 PM
Zeke Williams
Zeke Williams - avatar
+ 1
Please post your full code.
21st Apr 2018, 2:30 PM
Timon Paßlick