


























按照c++标准,编译器会生成五个默认成员函数:
一个空的class在C++编译器处理过后就不再为空,编译器会自动地为我们声明一些member function,如果你写 :
class Empty {};
就相当于:
class Empty
{
public:
Empty();
Empty(const Empty&);
~Empty();
Empty& operator=(const Empty& rhs);
Empty* operator&();
const Empty* operator&() const;
};
需要注意的是只有当你需要用到这些函数的时候,编译器才会去定义它们。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。