範例
class
A{
public
:
static
void
*
operator
new
(size_t size, newhandler nh);
};
class
B{
public
:
static
void
*
operator
new
(size_t size, newhandler nh);
};
解決方案
提供任何額外參數的預設值,或定義 new 的預設形式。
class
A{
public
:
static
void
*
operator
new
(size_t size, newhandler n
h
=0
);
};
class
B{
public
:
static
void
*
operator
new
(size_t size, newhandler nh);
static
void
*
operator
new
(size_t size){
return
::
operator
new
(size);
}
};