i need a static bool in each of my derived classes. obviously i cannot stick it in the base class because each of the derived classes needs it's own static bool. the only option i can see is declaring the static bool in each of the derived classes, but this seems to go against being OO.. Any other options?
at the moment i am doingCode:class Base { }; class Derived1 : public Base { public: static bool m_b; }; bool Derived1::m_b = false; class Derived2 : public Base { public: static bool m_b; }; bool Derived2::m_b = false; int _tmain(int argc, _TCHAR* argv[]) { Derived1 d1; Derived2 d2; Derived1::m_b=true; Derived2::m_b=false; return 0; }




Reply With Quote