动态内存分配在堆上:
class A{
protected:
A(){};
~A{};
public:
static A* create(){
return new A();
}
void destory(){
delete this;
}
};
静态内存分配在栈上:
class A{
private:
void* operator new(size_t t){};
void operator delete(void* _ptr){};
public :
A(){}
~A(){}
};