Q:
How would I go about making a vector of structs a private data member of a class?
I tried putting it in as just:
Code:
private:
vector<Trick> myTricks(1);
But I get errors to the effect of:
'Invalid use of undefined type'
'Forward declaration of class'
'Template argument 1 is invalid'
'Template argument 2 is invalid'
'Invalid data member initialization'
'ISO C++ forbids declaration of myTricks with no type'
myTricks is defined as:
Code:
struct Trick {
string name;
int time;
int diff;
};
If it matters, this is declared in class Pet, which is a subclass of Animal and a superclass of Dog and Cat.