在没有动手实验之前确实这个问题不能确定,我在理论中想象是否定的(或许你也是这样的想法),但事实告诉我们是可以的。
这是main中的测试代码:
在这之后我会提供给大家整个测试源代码。
#include "stdafx.h"
//#include<iostream>
//using namespace std;
#pragma comment(lib,"test.lib")//链接库文件
class drifirst :public frist
{
public:
int show(int i)
{
// frist.show(3);
printf("%s/n","test");
;//cout<<"派生"<<endl
return 0;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
frist *fp;
drifirst *fb=new drifirst;
fp=fb;
fp->show(2);
fb->show(1);
return 0;
}
这个问题还是超越了个人的想象,实践看来是更有效,更真实的做法。
程序代码:http://download.youkuaiyun.com/source/3273031 (包含lib库,及头文件等)