class A{ public: A(){msg();} virtual void msg(){AfxMessageBox(_T("A"));} }; class B: public A{ public: B():A(){} private: virtual void msg(){AfxMessageBox(_T("B"));} }; void test(){ B b; //will Message("A"); -------why? I think I can get Message("B")!----- A*pA=&b; pA->msg();//will Message("B"); }
Quote:B b; //will Message("A"); -------why? I think I can get Message("B")!-----
B
A
Quote:pA->msg();//will Message("B");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)