2017.12.23

来源:互联网 发布:中融信托工作知乎 编辑:程序博客网 时间:2024/05/22 00:33

初识C++:
1. 流(stream):随时间推移,字符顺序生成或消耗
2. manipulator操纵符 buffer缓冲区 initialize初始化
3. 名称空间namespace;using namespace std
4. c语言:传值;c++:传/引用/
5. streamstring:字符串流
6. ctor构造函数:声明变量时调用

struct Point {    int x, y;    Point(int x=0, y=0):x(x),y(y){}};struct Point {    int x, y;    Point(int x=0, y=0){ this->x =x; this->y =y;}};//this指的是当前对象的指针

此时Point()相当于Point(0,0)。
7.模板(template)

template <typename T>struct Point {    T x,y;    Point (T x=0, T y=0)x(x),y(y) {}};template <typename T>Point<T> operator + (const Point<T> &A,const Point<T> &B){    return Point<T>(A.x+B.x,A.y+B.y>;}
原创粉丝点击