### Overloaded new and delete

You can implement your own memory management scheme for a class by overloading the operators new and delete. The overloaded operator new must return a void*, and its first argument must have type size_t. The overloaded operator delete must return a void type, and its first argument must be void*. The second argument for the overloaded delete operator is optional and, if present, it must have type size_t. You can only define one delete operator function for a class.

Type size_t is an implementation dependent unsigned integral type defined in <stddef.h>.

The size argument is required because a class can inherit an overloaded new operator. The derived class can be a different size than the base class. The size argument ensures that the correct amount of storage space is allocated or deallocated for the object.

When new and delete are overloaded within a class declaration , they are static member functions whether they are declared with the keyword static or not. They cannot be virtual functions.

You can access the standard, nonoverloaded versions of new and delete within a class scope containing the overloading new and delete operators by using the :: (scope resolution) operator to provide global access.

Free Store
Delete Operator
New Operator