|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
编译时出现"unexpected end of file found",求大神解决啊!
#include <iostream.h>
class Employee
{
public:
Employee(char nm[],int id)
{name=nm;ID=id;}
~Employee(){};
int getid(){return ID;}
char *getid(int id){ID=id;}
void setid (int id){ID=id;}
void setname(char nm[]){name=nm;}
virtual int pay()=0;
virtual void print()=0;
protected:
char *name;
int ID;
};
class Manager:public Employee
{
public:
Manager(char nm[],int id,int sl):Employee(nm,id)
{sal=sl;}
~Manager(){};
int getsal(){return sal;}
void setsal(int sl){sal=sl;}
int pay(){return sal;}
void print()
{
cout<<endl<<"name:"<<name<<" ID:"<<ID<<"pay="<<pay()<<endl;
}
protected:
int sal;
};
class Hourlyworker:public Employee
{
public:
Hourlyworker(char nm[],int id,int w,int h):Employee(nm,id)
{wage=w;hour=h;}
~Hourlyworker(){};
int getwage(){return wage;}
void setwage(int w){wage=w;}
int gethours(){return hours;}
void sethours(int h){houes=h;}
int pay(){return hours*wage;}
void print()
{
cout<<"\nname:"<<name<<" ID:"<<ID<<"pay="<<pay()<<endl;
protected:
int wage;
int hours;
};
void main()
{
Manager manag("zhang",101,9000);
Hourlyworker hourw("li",112,30,8*29);
manag.print ();
hourw.print();
}
|
|