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

#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;
}
	

posted @ 2013-04-12 10:30  小尼人00  阅读(158)  评论(0编辑  收藏  举报