正在加载图片...
类的组合 类的组合/聚合: 将已有的类的对象作为新的类的成员。 Example class Point /声明Point类 { public: 。。。。。。 private: double×,y }; class Line /声明Line类 public: 。。·。·0 private: Point p1,p2; } http://math.ecnu.edu.cn/~jypanhttp://math.ecnu.edu.cn/~jypan 4 类的组合 类的组合/聚合: 将已有的类的对象作为新的类的成员。 class Point // 声明Point类 { public: ... ... private: double x, y; }; class Line // 声明Line类 { public: ... ... private: Point p1, p2; }; Example
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有