摘要:
1,设计只能在堆上分配的类方法:将类的构造函数或者析构函数设置为protected(private会限制继承),迫使类对象在栈的构造时编译出错#include<iostream>usingnamespacestd;classOnlyHeap{public:OnlyHeap(){cout<<"construct"<<endl;}voiddistory()const{deletethis;}protected:~OnlyHeap(){cout<<"destruct"<<endl;}};intmain 阅读全文
posted @ 2012-02-27 15:53
Hibernate4
阅读(208)
评论(0)
推荐(0)

浙公网安备 33010602011771号