C++面向对象程序设计Chapter 6 类与对象 - 2.pptVIP

  • 1
  • 0
  • 约10.44万字
  • 约 199页
  • 2020-05-07 发布于山东
  • 举报

C++面向对象程序设计Chapter 6 类与对象 - 2.ppt

#includeiostream using namespace std ; class Goods { public : Goods ( int w) { weight = w ; total_weight += w ; } ~ Goods() { total_weight -= weight ; } int Weight() { return weight ; } static int TotalWeight() { return total_weight ; } Goods *next ; private : int weight ; static int total_weight ; } ; int Goods::total_weight = 0 ; void purchase( Goods * f, Goods * r, int w ) { Goods *p = new Goods(w) ; p - next = NULL ; if ( f == NULL ) f = r = p ; else { r - next = p ; r = r - next ; } } void sale( Goods * f , Goods * r ) {

文档评论(0)

1亿VIP精品文档

相关文档