Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'class' : a managed or WinRT type may not define its own 'operator new' or 'operator delete'
Remarks
You can define your own operator new or operator delete to manage memory allocation on the native heap. However, reference classes cannot define these operators because they are only allocated on the managed heap.
For more information, see User-Defined Operators (C++/CLI).
Example
The following sample generates C2842.
// C2842.cpp
// compile with: /clr /c
ref class G {
void* operator new( size_t nSize ); // C2842
};