您的位置:首页 > 编程语言 > C语言/C++

[C++] 分别设计只能在栈, 堆中分配内存的类!

2013-04-12 10:30 127 查看
#include <iostream>

using namespace std;

class HeapOnly {
public :
HeapOnly() {}
void destroy() const {
delete this;
}
private :
~HeapOnly() {}
};

class HeapStack {
private :
static void* operator new(size_t size);
};

int main() {
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: