C++ 基础面试题-2
请写出一下程序的输出内容
/* ** 2018/03/21 22:02:03 ** Brief: ** Author:ZhangJianWei ** Email:Dream_Dog@163.com */ #include <iostream> #include <windows.h> class B { public: virtual void printfa(void) { printf("B::printfa\n"); } virtual void rePrintf(void) { printf("B::Reprintf\n"); } void funca(void) { printfa(); rePrintf(); } }; class D :public B { void printfa(void) { printf("D::printfa\n"); } }; int main(void) { B *p = new D(); p->printfa(); p->funca(); system("pause"); return 0; }
这道题我答对了,考验类,继承,重载