C++中关键字new的解释
interpretation of keyword new in C++
在 cppreference 的网站上,我看到以下句子:
This is a list of reserved keywords in C++. Since they are used by the language, these keywords are not available for re-definition or overloading.
关键词中,有new。但我知道我们可以在 C++ 中重载 new。
所以上面的引文是错误的,或者关键字 new ?
还有别的东西
您不能超载 new
。您可以重载 operator new
,这是 new
在构造对象之前调用以分配内存的函数。
在 cppreference 的网站上,我看到以下句子:
This is a list of reserved keywords in C++. Since they are used by the language, these keywords are not available for re-definition or overloading.
关键词中,有new。但我知道我们可以在 C++ 中重载 new。 所以上面的引文是错误的,或者关键字 new ?
还有别的东西您不能超载 new
。您可以重载 operator new
,这是 new
在构造对象之前调用以分配内存的函数。