如何只在堆上创建对象,如何只在栈上创建对象
//禁止在heap中
class number
{
private:
static void*operator new(size_t size);
static void operator delete(void*ptr);
..........
};
//禁止在栈上
class number
{
private:
~number();
public:
void destory()const{delete this;}
............
}