Employee(const long n,const char N){number=n,*name=*N;};
virtual~Employee(){};
const char getName(long n) const{};
const long getNumber() const{};
virtual double eamings() const=0;
virtual void print() const{cout<<"编号:"<<number<<"姓名"<<*name<<endl;};
protected:
long number;
char *name;
};
class Manager: public Employee
{ public:
Manager(const long n,const char *N,double u=0.0):Employee(n,*N){}错误的这里说没有匹配构造函数实例子
~Manager(){};
void setMonthlySalary(double n){number=n;};
virtual double eamings() const{return 0;};
virtual
void print()
const{cout<<"编号:"<<number<<"姓名"<<*name<<"月薪"<<monthlySalary<<endl;};
private:
double monthlySalary;
};int main()
{ cout<<setiosflags(ios::fixed|ios::showpoint)<<setprecision(2) ;
Manager m1(10135,"Cheng ShaoHua", 1200.0) ;
Manager m2(10201,"Yan HaiFeng");
m2.setMonthlySalary ( 5300.0) ;
蓝山帝景
天涯尽头无女友
长风秋雁
相关分类