您的位置:首页 > 编程语言 > C语言/C++

C++ Rule of Three

2016-01-31 16:58 489 查看

Rule of Three

The rule of three (also known as the Law of The Big Three or The Big Three) is a rule of thumb in C++ (prior to C++11) that claims that if a class defines one (or more) of the following it should probably explicitly define all three:[1]

destructor

copy constructor

copy assignment operator

如果需要析构函数,则一定需要拷贝构造函数和赋值操作符
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: