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

原文地址:https://www.cnblogs.com/robbychan/p/3786689.html