No default constructor exists
Reproduction:
Click the RUN button.
Why is it doing that? I am assigning a value! Is there a way to make a default value?
Ask coding questions
Reproduction:
Click the RUN button.
Why is it doing that? I am assigning a value! Is there a way to make a default value?
the way cpp works, is that if you dont initialize a member in the member initialization list, it gets a default constructor
so here is the new constructor
if you dont have the member initialization list, it will automatically call the default constructor for all the members, like this
and since
Point
has no default constructor (constructor with no arguments) defined, it will throw an error.You could also fix this error by adding a default constructor to
Point
like soin the public scope of your class
yay!! Thanks! @finlay44111
https://en.cppreference.com/w/cpp/language/constructor @Coder100