zy876054426 2015-05-08 01:39 采纳率: 0%
浏览 1607

求解答,问题出在那里,木有编译错误

// shiyan66.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"iomanip"
#include"iostream"
using namespace std;
class Employee

{ public:
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<<"编号:"< protected:
long number;
char name;
};
class Manager: public Employee
{ public:
Manager(const long n,const char
N,double u ):Employee(n, N){monthlySalary=u;}
~Manager(){};
void setMonthlySalary(long n){number=n;};
virtual double eamings() const{return 0;};
virtual void print() const{cout private:
double monthlySalary;
};
class HourlyWorker: public Employee
{ public:
HourlyWorker(const long n,const char* N,double=0.0, int=0):Employee(n, N){number=n,*name=*N;};
~HourlyWorker(){}
void setWage(double h){hours=h;};
void setHours(int w){wage=w;};
virtual double eamings() const{return hours*wage; };
virtual void print() const{cout private:
double wage;
double hours;
};
class PieceWorker: public Employee
{ public:
PieceWorker(const long n,const char* N,double=0.0, int=0):Employee(n, N){number=n,*name=*N;};
~PieceWorker(){}
void setWage(double w){wagePerPiece=w;};
void setQuantity(int q){quantity=q;};
virtual double eamings() const{return wagePerPiece*quantity;};
virtual void print() const{cout private:
double wagePerPiece;
int quantity;
};
int main()
{ cout Manager m1(10135,"Cheng ShaoHua", 1200) ;
Manager m2(10201,"Yan HaiFeng",1000);
m2.setMonthlySalary ( 5300) ;
HourlyWorker hw1(30712,"Zhao XiaoMing",5,8*20) ;
HourlyWorker hw2(30649,"Gao DongSheng" ,6,98*8) ;
hw2.setWage(4.5) ;
hw2.setHours(10*30) ;
PieceWorker pw1(20382,"Xiu LiWei",0.5,2850) ;
PieceWorker pw2(20496,"Huang DongLin" ,1,23*10) ;
pw2.setWage(0.75);
pw2.setQuantity (1850);
Employee*basePtr;
basePtr=&m1 ; basePtr=&m2; basePtr=&hw1 ; basePtr=&hw2 ; basePtr=&pw1 ; basePtr=&pw2 ;
basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print(); basePtr->print();
return 0;
}

  • 写回答

4条回答 默认 最新

  • yangbo50304 2015-05-08 05:49
    关注

    你这还没有编译错误么?一坨一坨的错误,你到底用的哪家的编译器?蓝翔的吗?还木有编译错误

    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝批量检测实名工具
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题