What's the point in defaulting functions in C++11?

后端 未结 8 1447
失恋的感觉
失恋的感觉 2020-12-03 03:41

C++11 adds the ability for telling the compiler to create a default implementation of any of the special member functions. While I can see the value of deleting a function,

8条回答
  •  时光取名叫无心
    2020-12-03 03:57

    A defaulted constructor will have a declaration, and that declaration will be subject to the normal access rules. E.g. you can make the default copy constructor protected. Without these new declarations, the default generated members are public.

提交回复
热议问题