My class with overloaded constr requires default constructor while second donesn't

My class Game with overloaded constructor Game(std::string); doesn't require default constructor. While second class Object with overloaded constructor Object::Object(std::string object_name, std::string object_texture_path) require (prints error http://i.imgur.com/0uD7pHB.png) default constructor. I can fix it by adding default constructor (Object()), but I also wan't to know why is that working. I hope someone understands what is going on :).
If the user adds no "overloaded" constructor, then the compiler generates the default constructor.

A class needs a constructor that takes no arguments (i.e. the default) only when it is used in a way that needs that constructor. Your program creates Games and Objects, but in every place that you create a Game, you probably give an argument.
Not used -> not needed.


PS. In C++11 one can
1
2
3
4
class Object {
  Object() = default;
  // other code
};

https://en.wikipedia.org/wiki/C%2B%2B11#Explicitly_defaulted_and_deleted_special_member_functions
Thank you!
Topic archived. No new replies allowed.