C++教程教学课件 作者 郑莉 李宁 08_类的重用.pptVIP

  • 1
  • 0
  • 约1.65万字
  • 约 67页
  • 2019-10-04 发布于广东
  • 举报

C++教程教学课件 作者 郑莉 李宁 08_类的重用.ppt

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 例8-8:家具类中的向上转型 //Furniture.h #includeiostream #includestring using namespace std; class Furniture //家具类 { private: string type; //家具类型 string mat; //家具主材料 double price; //家具价格 public: Furniture(){}; Furniture(string type, string mat, double price): type(type), mat (mat),price(price){} string getMaterial(){ return mat; } double getPrice(){ return price; } string getType(){ return type; } }; * 8.2 类的继承——8.2.5向上转型 例8-8(续) class Sofa: publ

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档