2012年4月15日

孙鑫教程第三章小测试程序

摘要: #include <IOSTREAM.H> //定义一个基类,模拟CWinApp class Base { public: Base(); // virtual void fn();/*测试虚函数结果:call the Derived's fn*/ void fn();/*测试非虚函数结果:call the Base's fn*/ Base *p; }; Base::Base() { p = this;//this指针指向哪一个对象?答:指向派生类对象dd } void Base::fn() { cout << "call the Base&# 阅读全文

posted @ 2012-04-15 17:05 阿杜的世界 阅读(137) 评论(0) 推荐(0)

导航