类的编译与运行
#include <iostream.h>#include <cstring>
class employee
{
public:
employee(char *a,char*b,char*c,int d)
{
strcpy(ia,a);
strcpy(ib,b);
strcpy(ic,c);
id=d;
}
display()
{
cout<<"姓名:"<<ia<<endl;
cout<<"地址:"<<ib<<ic<<endl;
cout<<"邮政编码"<<id;
}
~employee();
protected:
char ia[20];
char ib[20];
char ic[20];
int id;
};
int main()
{
employee a ("小红","长江中路2号","山东省青岛市",266520);
a.display();
return 0;
}
在编译的时候没有问题,但是在运行的时候却有两个问题,为error LNK2001: unresolved external symbol "public: __thiscall employee::~employee(void)" (??1employee@@QAE@XZ)
Debug/15.1.1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.