C++默认函数

总共有6个。

构造、拷贝构造、析构函数   赋值运算、取址、取址const

http://blog.sina.com.cn/s/blog_5f76aaf20100cwlj.html

 1 class Empty
 2 {
 3 public:
 4 Empty(); // 缺省构造函数
 5 Empty( const Empty& ); // 拷贝构造函数
 6 ~Empty(); // 析构函数
 7 Empty& operator=( const Empty& ); // 赋值运算符
 8 Empty* operator&(); // 取址运算符
 9 const Empty* operator&() const; // 取址运算符 const
10 };
View Code

 当有自定义的构造函数时,默认构造函数失效。

posted @ 2013-07-09 20:04  renhl  阅读(162)  评论(0编辑  收藏  举报