effective c++ 条款10的问题
class Airplane { // 修改后的类 — 支持自定义的内存管理
public: //
static void * operator new(size_t size);
...
private:
union {
AirplaneRep *rep; // 用于被使用的对象
Airplane *next; // 用于没被使用的(在自由链表中)对象
};// 类的常量,指定一个大的内存块中放多少个
// Airplane 对象,在后面初始化
static const int BLOCK_SIZE;
static Airplane *headOfFreeList;
};
请解释下,使用union的目的和作用,不是很明白。