RAD Studio
ContentsIndex
PreviousUpNext
E2025: Assignment to 'this' not allowed, use X::operator new instead (C++)

In early versions of C++, the only way to control allocation of class of objects was by assigning to the 'this' parameter inside a constructor. 

This practice is no longer allowed, because a better, safer, and more general technique is to define a member function operator new instead. 

For example:

this = malloc(n);
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!