只要是在主函数里定义了对象,程序连结就出这样的问题了,谁能告诉我是哪的问题啊……先谢谢了
实验报告最新修改.obj : error LNK2001: unresolved external symbol "public: __thiscall Salesperson::Salesperson(void)" (??0Salesperson@@QAE@XZ)
Debug/实验报告最新修改.exe : fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include <string>
using namespace std;
class Employee//employee类
{public:
Employee(){}
Employee(string na,float sa,int ti,int n):name(na),salary(sa),time(ti),no(n)
{
no=0;
salary=800;
ti=20000101;}
virtual void setSalary()=0;
void pay()//输出工资
{cout<<"The salary of the salesman is:"<<salary<<endl;}
void getNo()//输出工号
{no++;
cout<<no<<endl;}
void setName()//输入姓名
{cout<<"Please input the name of the employee:"<<endl;
cin>>name;}
void getName()//输出姓名
{cout<<name<<endl;}
void setTime()//输入工作时间
{cout<<"Please input the time of the employee:"<<endl;
cin>>time;}
void getTime()//输出时间
{cout<<time<<endl;}
protected:
string name;
float salary;
int time;
int no;
};
class Salesperson:public Employee//销售员类,继承employee类
{
public:
Salesperson();
Salesperson(string na,float sa,int ti,int n,int m,float to):Employee(na,sa,ti,n)
{salesamount=to;
m=0;}
~Salesperson()
{}
virtual void setSalary()
{cout<<"请输入卖出数:"<<endl;
cin>>salesamount;
if (salesamount<10)
salary=salary*(1+0.03);
else if(salesamount<100)
salary=salary*(1+0.08);
else salary=salary*(1+0.1);
m+=salesamount;
}
void pay()
{cout<<"The salesamount is:"<<salesamount<<"The salary of the salesman is:"<<salary<<endl;}
protected:
int m;
float salesamount;
};
class Salesmanager:public Salesperson
{public:
//Salesmanager();
Salesmanager(string na,float sa,int ti,int n,int m,float to):Salesperson(na,sa,ti,n,m,to){}
virtual void setSalary()
{if(m<500)salary=800*(1+0.03)+700;
else salary=800*(1+0.08)+700;
}
};
int main()//主函数
{
//Salesperson s1;
//Salesmanager m1;
return 0;
}
实验报告最新修改.obj : error LNK2001: unresolved external symbol "public: __thiscall Salesperson::Salesperson(void)" (??0Salesperson@@QAE@XZ)
Debug/实验报告最新修改.exe : fatal error LNK1120: 1 unresolved externals
#include <iostream>
#include <string>
using namespace std;
class Employee//employee类
{public:
Employee(){}
Employee(string na,float sa,int ti,int n):name(na),salary(sa),time(ti),no(n)
{
no=0;
salary=800;
ti=20000101;}
virtual void setSalary()=0;
void pay()//输出工资
{cout<<"The salary of the salesman is:"<<salary<<endl;}
void getNo()//输出工号
{no++;
cout<<no<<endl;}
void setName()//输入姓名
{cout<<"Please input the name of the employee:"<<endl;
cin>>name;}
void getName()//输出姓名
{cout<<name<<endl;}
void setTime()//输入工作时间
{cout<<"Please input the time of the employee:"<<endl;
cin>>time;}
void getTime()//输出时间
{cout<<time<<endl;}
protected:
string name;
float salary;
int time;
int no;
};
class Salesperson:public Employee//销售员类,继承employee类
{
public:
Salesperson();
Salesperson(string na,float sa,int ti,int n,int m,float to):Employee(na,sa,ti,n)
{salesamount=to;
m=0;}
~Salesperson()
{}
virtual void setSalary()
{cout<<"请输入卖出数:"<<endl;
cin>>salesamount;
if (salesamount<10)
salary=salary*(1+0.03);
else if(salesamount<100)
salary=salary*(1+0.08);
else salary=salary*(1+0.1);
m+=salesamount;
}
void pay()
{cout<<"The salesamount is:"<<salesamount<<"The salary of the salesman is:"<<salary<<endl;}
protected:
int m;
float salesamount;
};
class Salesmanager:public Salesperson
{public:
//Salesmanager();
Salesmanager(string na,float sa,int ti,int n,int m,float to):Salesperson(na,sa,ti,n,m,to){}
virtual void setSalary()
{if(m<500)salary=800*(1+0.03)+700;
else salary=800*(1+0.08)+700;
}
};
int main()//主函数
{
//Salesperson s1;
//Salesmanager m1;
return 0;
}