정확한 구조는 모르겠는데 아무튼 잘됨.
in msvc
| 1234567891011121314151617181920212223242526272829 | #include class A{public: void method() { auto ptr = static_cast<void()()>( //()-void 형의 함수형으로 캐스팅 ** reinterpret_cast<void**>(this) //void**로 캐스팅 후 두번 참조. ); ptr(); }private: virtual void print() const = 0;}; class B : public A{ virtual void print() const { printf("hello"); }}; int main(){ A obj = new B(); obj->method();}Colored by Color Scripter | cs |