C++
Werky_blog
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++文件
class Point1{public: Point1(int x=0,int y=0):x(x),y(y){ count++; } Point1(const Point1 &p); ~Point1(){count--;} //Îö¹¹º¯Êý int getx(){return x;} int gety()原创 2017-09-03 17:08:03 · 246 阅读 · 0 评论 -
对象数组 (线性拟合)
1.先调用构造函数初始化2.调用函数赋值3.main函数结束后,自动调用析构函数。线性拟合:#include#includeusing namespace std;class Point{public: Point(float x=0,float y=0):x(x),y(y){} float getx() const {return x;} flo原创 2017-09-03 19:00:23 · 620 阅读 · 0 评论 -
复制构造函数
#includeusing namespace std;class Point{public: Point(int xx=0,int yy=0){ x=xx; y=yy; } Point(Point &p); //复制构造函数 int getX(){ return x; }原创 2017-09-02 11:55:14 · 285 阅读 · 0 评论 -
联合体
#include#includeusing namespace std;class ExamInfo{public: //构造函数,函数重载 //ExamInfo(string name,char grade) //:name0(name),mode(GRADE),grade(grade){} //这两种写法都是可以的,只是用带冒号的可以用相同名字原创 2017-09-02 13:01:39 · 333 阅读 · 0 评论 -
生存期
/*1.静态生存期:调用函数时会保持上次的值,只能初始化一次 在命名空间作用域声明的对象,和在类作用域和局部作用域声明用static的对象2.动态生存期: 除了上述两种情况均为动态*/#includeusing namespace std;class Clock{public: Clock();//构造函数,函数名与类名相同 void setTim原创 2017-09-02 13:28:13 · 240 阅读 · 0 评论 -
静态函数成员
#include #include using namespace std;class Point{public: Point(int x=0,int y=0):x(x),y(y){ count++; } Point(Point &p){ x=p.x; y=p.y; count++; }原创 2017-09-03 15:06:01 · 208 阅读 · 0 评论 -
C++ this
this:指向对象的指针。this->s=s;参数与成员变量相同时,要这么用才能赋给成员变量。http://www.cnblogs.com/liushui-sky/p/5802981.html原创 2017-10-08 20:04:51 · 324 阅读 · 0 评论 -
C++ 函数
count():返回这个值出现次数。还可以在一个范围里。count(ivec.begin() , ivec.end() , searchValue)头文件:algorithm原创 2017-10-09 21:01:17 · 217 阅读 · 0 评论
分享