初识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>;
}