If I have something like
class Base { static int staticVar; } class DerivedA : public Base {} class DerivedB : public Base {}
Will bot
To ensure that each class has its own static variable, you should use the "Curiously recurring template pattern" (CRTP).
template class Base { static int staticVar; }; template int Base::staticVar(0); class DerivedA : public Base {}; class DerivedB : public Base {};