class Zombie { public: Zombie(); Zombie(int howTall); Zombie(int howTall, int howHeavy); int getHeight(); private: int height; int weight; }; Zombie::Zombie() { height = 6; weight = 180; } int main() { Zombie army[4]; for(int i = 0; i < 4; i++) army[i] = Zombie; } Why do I get the error when I try to set army[i] = Zombie? Army is an array of Zombies and I already wrote a default constructor for the Zombie class. when I replace Zombie with Zombie(), the code works, but shouldn't omitting the () call the default constructor as well?
Not shown: the other constructors and methods are implemented already.
I know that if I declare army to be an array of pointers to Zombies and do army[i] = new Zombie it will work, but I don't know why the above code doesn't.
Thanks