//目录
摘要: ///继承与派生 #include <iostream> using namespace std; class Point { public: Point (float a=0,float b=0):x(a),y(b) {} ///有默认参数的构造函数 void setPoint (float,fl 阅读全文
posted @ 2016-04-30 23:29 小草的大树梦 阅读(384) 评论(0) 推荐(0)
摘要: ///友元 ///友元有利于数据共享,但是破坏了类的封装性 #include <iostream> using namespace std; class Time { public: Time (int h=10,int m=10,int s=10):hour(h),minute(m),sec(s) 阅读全文
posted @ 2016-04-30 22:18 小草的大树梦 阅读(163) 评论(0) 推荐(0)
摘要: ///对象指针 #include <iostream> using namespace std; class Time { public: Time(int h=10,int m=10,int s=10):hour(h),minute(m),sec(s) {} int hour; int minut 阅读全文
posted @ 2016-04-30 21:56 小草的大树梦 阅读(178) 评论(0) 推荐(0)
摘要: ///简单的使用类和对象 #include <iostream> using namespace std; ///构造函数的重载,求体积 class Box { public: Box(); ///不带参数的构造函数,来初始化 Box(int h,int w,int l):height(h),wid 阅读全文
posted @ 2016-04-30 21:21 小草的大树梦 阅读(294) 评论(0) 推荐(0)
摘要: 小草的C++要结课了,小草终于翻起书来,小草用的老谭的书,有什么不对的就找老谭去吧。 ///C++初步 ///C++对C的扩展 #include <iostream> using namespace std; ///const定义常量 const int inf=0x3f3f3f3f; int ma 阅读全文
posted @ 2016-04-30 20:18 小草的大树梦 阅读(386) 评论(0) 推荐(0)