UML类图和对象图28.pptVIP

  • 21
  • 0
  • 约7.48千字
  • 约 81页
  • 2017-07-16 发布于四川
  • 举报
第六章 类图与对象图 6.2 类图的组成 class Invoice{ public: double amount; Date daate=new Date(); char customer; Invoice(){ number_of_invoices++;} private: static int number_of_invoices; }; int Invoice ::number_of_invoices=0; 6.2 类图的组成 Eg1:每个人都有自己的姓名(name)与年龄(age),均可以改变姓名(changeName(…))、增加年龄(increaseAge()) 要求将其建模。 Eg2: class Trade{ String product;//产品 int quantity;//数目 double total_price;//总价格 //运算:计算价格 void calculatePrice(){ //提取单价unit_price,然后计算总价格 //total_price=unit_price*quantity //数量大时另加折扣 } } 6.2 类图的组成 抽象类的原则:不能创建具体实例的类。 在C++中,即为

文档评论(0)

1亿VIP精品文档

相关文档