摘要: 1)“多态”的关键在于通过基类指针或引用调用一个虚函数时,编译时不确定到底调用的是基类还是派生类的函数,运行时才确定 -- 这叫 “动态联编”。2)分析下面示例的运行结果class Base {public: int i; virtual void Print() {cout Print... 阅读全文
posted @ 2015-06-24 22:04 阿青1987 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 1)头文件 game.h#ifndef GAME_H#define GAME_H// base classclass CCreature {protected: int m_nLifePower, m_nPower;public: virtual void Attack(CCreatur... 阅读全文
posted @ 2015-06-24 13:14 阿青1987 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 1)使用vc6 编写动态库,动态库源码 (dll_test.cpp) 如下:#include // _declspec(dllexport) means test() can be called by othersvoid _declspec(dllexport) test() { Messa... 阅读全文
posted @ 2015-06-24 09:45 阿青1987 阅读(700) 评论(0) 推荐(0) 编辑
摘要: windows 下动态库的动态库简写为DLL(Dynamic Linkable Library),是一种可执行文件,但是它又不同于EXE文件,DLL不能独立运行,而是等待被调用。DLL编译后不能查看源代码,这起到了保护软件作者版权的作用。由于DLL文件本身不可以运行,而是需要通过应用程序调用来达到执... 阅读全文
posted @ 2015-06-24 08:48 阿青1987 阅读(178) 评论(0) 推荐(0) 编辑