Suppose I have a class with overloaded operator new.
class Class {
public:
void* operator new( size_t );
void operator delete( void* );
};
Will objects of that class always be allocated with the overloaded operator new when I use new Class() or is it possible that the default operator new is used when new Class() construct appears in code?
The overloaded
operator newandoperator deletewill always be used unless you explicitly do something like this:Or, as a somewhat extreme illustrative example, something like this:
Hope this helps.