c++ - Access "this" pointer of concrete class from interface -
after writing test, determined this pointer in interface not equal this pointer of concrete class, meaning can't use c-style cast on it. class abstractbase {...}; class aninterface { public: aninterface() {...} // need abstractbase * here ~virtual aninterface() {...} // , here }; class concrete : public abstractbase, public aninterface {}; my interface needs base class pointer concrete class inheriting in constructor , destructor in order handle interface related registration , deregistration. every concrete object inherits interface needs inherit abstract base class first, first in layout. for constructor not hard, can add pointer in interface constructor , pass this concrete class. destructor doesn't have parameters, in dark there. the solutions came far come overhead: 1 - store pointer in interface used in destructor - adds in 1 pointer worth of memory overhead class aninterface { public: aninterface(abstractbase * ap) {...} ~virtual a...