I will try my best to explain wht i think its going on here. You might want to listen to more experienced people though.
So you are creating a class Creature that can be created only if you provide 3 arguments (pos, size, color). Then in ofApp you want tot create an instance to it without providing any argument:
Creature creature;
This is contradictory and the compiler complains.
There are several solutions here.
The first one (not recommended) is to turn that instance into a pointer. so it becomes:
Creature* creature;
and then in setup you can create the object with new:
creature = new Creature(ofPoint(2,2), 65, ofColor::red);
which means that you will have to delete it at some point, which could lead to difficulties.
The second solution I suggest, i think is cleaner and better, just allow the creation of the class without arguments with a constructor with no arguments, and much better if you give a default value to those parameters (pos, size, color)
There are some tips like using an empty default constructor or forward declaration. I kind of get the general idea but it is quite still fuzzy to me.
So i tried the C++11 way
//Creature
class Creature {
public:
Creature() = default;
Creature(ofPoint _pos, int size, ofColor _color);
vector<Branch> branches;
};
and it works.
But what is bugging me here is i am creating a default constructor for Creature, but this class includes a vector of Branch objects which also don’t have a default constructor but it works without complaining…
yes, resize for example shouldn’t work but as long as the vector is empty and you push the elements one by one the default constructor is not being used