我的代码:
void* CMy::operator new(unsigned int size,const char * file,int line)
{
return NULL ;
} void CMy::operator delete(void* ptr,const char *file,int line)
{
} CMy* pMy = new CMy () ;
delete pMy ; // error C2573: 'CMy' : cannot delete pointers to objects of this type; the class has no non-placement overload for 'operator delete'.
如果重载只带一个参数的delete操作符就没问题了。 why ?
void* CMy::operator new(unsigned int size,const char * file,int line)
{
return NULL ;
} void CMy::operator delete(void* ptr,const char *file,int line)
{
} CMy* pMy = new CMy () ;
delete pMy ; // error C2573: 'CMy' : cannot delete pointers to objects of this type; the class has no non-placement overload for 'operator delete'.
如果重载只带一个参数的delete操作符就没问题了。 why ?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货