Hi, everyone. I have a simple (or complex) c++ question. The below source code do not be compiled and make errors. I really don't know why. Maybe I'm too foolish -_-; I'll wating for your answering. Thanks so much. /****** begin of source ******/ class Widget { protected: void draw() {} int _i; }; class Button : public Widget { protected: void draw() { ((Widget*)this)->_i++; ((Widget*)this)->draw(); } }; void main() {} /******* end of source ********/ I think that it's a compiler (internal) problem. I compiled it with VC++ and GCC but All failed. I think that the problem comes from accessing of type-casted 'this' pointer But I don't know exactly. Happy new year.
********************** |