HI.
Is there any way I can use inheritance in order to enforce my derived class use a static member?
Like:
So that every derived class would be enforced to use a static member?Code:class Base { ... } class Derived : public Base { public: static int _classNum; }
I thought about pure virtual methods (getter/setter) in the Base class,
but they won't assure that the derived classes are defining the variable as static.
Is there a logic solution for that (I got it as an assignment, with this constraint)




Reply With Quote