第二章 类及对象.pptVIP

  • 3
  • 0
  • 约1.57万字
  • 约 88页
  • 2017-06-08 发布于湖北
  • 举报
例2.11 (续一)。 ~ Date (){ coutDestructor called.dayendl; } void Print(){ coutMonth=month,Day=day ,Year=yearendl; } private: int month, day ,year; }; int main(){ 2.6对象数组与对象指针 例2.4 (续二) CLine::CLine(CPoint ps, CPoint pe): start(ps), end(pe) { cout CLine 构造函数被调用 endl; } float CLine::GetDistance() { double x = double (end.GetX() - start.GetX() ); double y = double (end.GetY() - start.GetY() ); return (float) sqrt(x*x + y*y ); } 2.3 类的组合 例2.4 (续三) int main(){ CPoint p1(1,1), p2(4,5); CLine l(p1, p2); cout The dis

文档评论(0)

1亿VIP精品文档

相关文档