This is more like a general query than a question, but basically I was wondering whether it was possible to have a vector as a member of a class that stored objects of another class. For Example:
#include <vector>
class Class2
{
};
class Class1
{
public:
std::vector<Class2> myvector;
};
int main ( )
{
Class1 object1;
Class2 object2;
object1.myvector.push_back ( object2 );
}
Class2 has to be declared before Class1 for Class1 to use it, and myvector has to be public for you to use push_back on it. You also can't initialize myvector's size like that.