文件名称:a
- 所属分类:
- Windows编程
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 5kb
- 下载次数:
- 0次
- 提 供 者:
- mfclo*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
由Point类派生出描述一个矩形的类Rectangle (左上角、右下角两点确定矩形) :
Rectangle类的成员数据:
① 公有继承Point类后已有1个点;
② 再增加1个成员对象: protected: Point p2
③ 增加存放周长的成员数据: protected: float length
④ 增加存放面积的成员数据: protected: float rectarea
Rectangle类的成员函数、友元函数:// float distance(){return 2*(abs(x-p2.x)+abs(y-p2.y)) }
float area(){return abs(x-p2.x)*abs(y-p2.y) } 派生类对象不可访问对象的protected的成员!!
-Derived from the Point class describes a rectangle class Rectangle (upper left, lower right corner points determine the rectangle): Rectangle class members of the data: ① public inheritance after the Point class has a point ② to add a member object: protected: Point p2 ③ increase in circumference of the members of the data store: protected: float length ④ members to increase the data storage area: protected: float rectarea Rectangle class member function, friend function:// float distance () ( return 2* (abs (x-p2.x)+ abs (y-p2.y)) ) float area () (return abs (x-p2.x)* abs (y-p2.y) ) derived class object can not access protected members of object! !
Rectangle类的成员数据:
① 公有继承Point类后已有1个点;
② 再增加1个成员对象: protected: Point p2
③ 增加存放周长的成员数据: protected: float length
④ 增加存放面积的成员数据: protected: float rectarea
Rectangle类的成员函数、友元函数:// float distance(){return 2*(abs(x-p2.x)+abs(y-p2.y)) }
float area(){return abs(x-p2.x)*abs(y-p2.y) } 派生类对象不可访问对象的protected的成员!!
-Derived from the Point class describes a rectangle class Rectangle (upper left, lower right corner points determine the rectangle): Rectangle class members of the data: ① public inheritance after the Point class has a point ② to add a member object: protected: Point p2 ③ increase in circumference of the members of the data store: protected: float length ④ members to increase the data storage area: protected: float rectarea Rectangle class member function, friend function:// float distance () ( return 2* (abs (x-p2.x)+ abs (y-p2.y)) ) float area () (return abs (x-p2.x)* abs (y-p2.y) ) derived class object can not access protected members of object! !
(系统自动生成,下载前可以参看下载内容)
下载文件列表
a\a.dsp
.\a.dsw
.\a.ncb
.\df.cpp
.\a.opt
.\Debug
a
.\a.dsw
.\a.ncb
.\df.cpp
.\a.opt
.\Debug
a