#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++] 分别设计只能在栈, 堆中分配内存的类!
最新推荐文章于 2025-02-25 23:36:40 发布