c++从入门到精通第二版 11.5.2 编译通过不了
发表在C++图书答疑
2017-05-31
是否精华
是
否
版块置顶:
是
否
#include<iostream>
using namespace std;
class CEmployee
{
public:
int m_ID;
char m_Name[128];
char m_Depart[128];
virtual void OutputName()=0;
};
class COperator:public CEmployee
{
public:
char m_Password[128];
void outputName()
{
cout<<"操作员姓名:"<<m_Name<<endl;
}
COperator()
{
strcpy(m_Name,"MR");
}
};
class CSystemManager:public CEmployee
{
public:
char m_Password[128];
void OutputName()
{
cout<<"系统管理员姓名:"<<m_Name<<endl;
}
CSystemManager()
{
strcpy(m_Name,"SK");
}
};
int main(int argc,char*argv[])
{
CEmployee*pWorker;
pWorker=new COperator();
pWorker->OutputName();
delete pWorker;
pWorker=NULL;
pWorker=new CSystemManager();
pWorker->OutputName();
delete pWorker;
pWorker=NULL;
return 0;
}
首页上一页 1 下一页尾页 1 条记录 1/1页