#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;
}
[C++] 分别设计只能在栈, 堆中分配内存的类!
最新推荐文章于 2022-10-05 11:48:40 发布