帮忙看下哪错了,应怎样改?谢谢!~~
class Date
{
private:
int year,month,day;
public:
Date(int a,int b,int c)
{year=a;month=b;day=c;}
Date(Date &n)
{year=n.year;
month=n.month;
day=n.day;
}
int Getyear(){return year;}
int Getmonth(){return month;}
int Getday(){return day;}
};
class employee
{
protected:
int individualEmpNo;
char sex;
Date birthday;
char cardNo[20];
static int employeeNo;
public:
employee(Date xbirthday);
~employee();
void SetcardNo(char *);
char * GetcardNo();
int GetindividualEmpNo();
void Setsex(char p);
char Getsex();
};
#include
int employee::employeeNo=1000;
employee::employee(Date xbirthday)
:birthday(xbirthday)
{individualEmpNo=employeeNo++;sex='\0';}
employee::~employee(){}
void employee::SetcardNo(char *Number)
{strcpy(cardNo,Number);}
void employee::Setsex(char p)
{sex=p;}
char employee::Getsex()
{return sex;}
#include
using namespace std;
int main()
{
employee emp[20];
Date date[20];
char cnumber[20];
char p;
int i,x,y,z;
for(i=0;i>p;
emp.Setsex(p);
cout>x>>y>>z;
date(x,y,z);
cout>cnumber;
emp.SetcardNo(cnumber);
}
//显示信息
for(i=0;i<4;i++)
{
cout<<"编号:"<<emp.GetindividualEmpNo()<<"性别:"<<emp.Getsex()<<"出生日期:"
<<date.Getyear()<<"-"<<date.Getmonth()<<"-"<<date.Getday()<<"身份证号:"
<<emp.GetcardNo()<<endl;
}
return 0;
}
编绎器提示有如此错误:
employee emp[20]错误:'employee' : no appropriate default constructor available
Date date[20];错误: error C2512: 'Date' : no appropriate default constructor available
date(x,y,z);错误: term does not evaluate to a function
|