C++ 里面default的作用是什么?
ringa_lee
ringa_lee 2017-04-17 13:17:23
0
2
748

我的意思是:既然我已经重载了拷贝控制函数/运算符,为什么还要保留编译器自动生成的合成拷贝控制呢?

ringa_lee
ringa_lee

ringa_lee

reply all(2)
迷茫

Personally, I think that sometimes overloading copy constructors/operators is to show that copy control related functions have been taken into account when creating a class. When the copy control function synthesized by the compiler meets the needs, use =default You don’t have to write it yourself again. If other data members are added to the class in the future and copy control needs to be customized, there is no need to add copy constructors/operators, but only need to modify the existing ones.

Ty80

is equivalent to the last else in
if...else if...else...
. The meaning is the same

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!