第6节 多态性与虚函数.pptVIP

  • 24
  • 0
  • 约1.66万字
  • 约 61页
  • 2018-06-21 发布于湖北
  • 举报
DataBase类 Author,title,year Disp,构造函数 Painting类 Width,height Disp,构造函数 Music类 key Disp,构造函数 class DataBase { protected: char author[10];//作者 char title[20];//名字 int year;//年份 public: DataBase(char *author,char title[],int year) { strcpy(this-author,author); strcpy(this-title,title); this-year=year; } virtual void disp(); }; void DataBase::disp() { cout 作者:this-authorendl; cout 名字:this-titleendl; cout 年份:this-yearendl; } class Painting:public DataBase { private: int height,width; public: Painting(char *author,char *title,int year,int width,int height):DataBase(author,title,

文档评论(0)

1亿VIP精品文档

相关文档