面向对象的程序设计.docxVIP

  • 4
  • 0
  • 约1.4千字
  • 约 4页
  • 2022-06-14 发布于山东
  • 举报
面向对象的程序设计 一、单选题1-5BDACC 6-10BADDA 二、填空 1.6 7 2.4.3 3.5.8 4.3.4 5.1.7 6.a .int 7.4 8.Ab e 9.X ab 10.私有 保护 三、程序填重题 四、理解问答题 #include iostream.h #include math.h class rectangle // { private: int x1,y1,x2,y2; // public: rectangle(int xx1,int yy1,int xx2,int yy2) { x1=xx1;y1=yy1;x2=xx2;y2=yy2; } int getarea() // { return abs((x2-x1)*(y1-y2)); } }; void main() { rectangle rect1(3,7,8,5); coutrect1.getarea()endl; #include iostream.h class car; class boat{ private: int weight; // public: boat(int w):weight(w){} // friend int totalweight(boat b1,car c1)

文档评论(0)

1亿VIP精品文档

相关文档