C++学习笔记

来源:互联网 发布:ubuntu修复grub引导 编辑:程序博客网 时间:2024/06/17 01:45

11/4/16-01:

如果你想禁止某些东西,就应该把完成它的操作定义为一个私用的成员函数。(the design and evolution of cpp)

如1)只要将析构函数声明为私用就可以避免堆栈和全局分配,这样做还能防止随便使用delete:

 

2)声明一个不大寻常的operator new(), 只允许全局和堆栈变量,禁止自由空间分配;

3) 对派生的控制, 一个比较tricky的方法

 

11/4/16-02: 操作符重载 prefix ++ and postfix ++

 

11/4/22 __FUNCTION__ Macro get the name of a function as a string