C++ 默认函数介绍

1. 构造函数

1
2
3
4
5
class A {
public:
A();
~A();
};

2. 析构函数

1
2
3
4
class A {
public:
~A();
};

3. 拷贝构造函数

1
2
3
4
class A {
public:
A(const A& other);
};

4. 赋值运算符重载

1
2
3
4
class A {
public:
A& operator=(const A& other);
};

5. 移动构造函数

1
2
3
4
class A {
public:
A(A&& other);
};

6. 移动赋值运算符重载

1
2
3
4
class A {
public:
A& operator=(A&& other);
};