Hi, I have quite a lot of classes declared, all of them are inheriting from a base (kind of abstract) class ... so all of them have common methods I'd like to use ...
now, I need to have a list of classes (not objects), later make instance of them in a loop and use the instances for calling mentioned common methods ...
the pseudo-code
class Abstract {
void Something();
}
class TaskOne : public Abstract {
void Something(); // method implemented somewhere below
}
class TaskTwo : public Abstract {
void Something(); // method implemented somewhere below
}
...
list<Abstract> lst;
lst.push_back(TaskOne); // passing class type, not instance!
lst.push_back(TaskTwo);
Abstract tmpObject = new lst[0]; //I know its wrong, just a way of expressing what I'd like to do to have instance of TaskOne!
please give any tips ...