Vector of objects
- by Paul
I've got a abstract class
class A {
public:
virtual void somefunction() = ;
};
and some different classes that inherit this class:
class Ab {
public:
void somefunction();
};
etc.
I want to make a vector containing some objects of these classes (how many depends on input parameters) so I can access these easily later. However I'm a bit lost on how to do this. My best idea is
vector<A> *objectsVector;
Ab AbObject;
objectsVector.push_back(AbObject);
However this gives me a huge amout of errors from various .h files in /usr/include/c++
How should i solve this?