I currently have a program that has multiple derived classes. All instances of a derived class are stored inside of that class's static vector of pointers. I also have a static vector of pointers which is inside of the base class which stores any object that has been derived from it. Whenever I add an object I currently have two push backs, one for the derived class and one for the base class. This means I also have to do two deletions when I want to get rid of an object. Is there anyway I can store the static vectors of pointers of all my derived classes in my base class? I keep thinking about using a 2d vector in my base class, would that work?
class Derived_class : public Base_class
{
static std::vector<Derived_class *> Lamps
}
class Derived_class2 : public Base_class
{
static std::vector<Derived_class2 *> Tables
}
class Base_class
{
static std::vector<Base_class *> Furniture
}
Sorry in advance for any faux pas or if I'm not giving enough information.