overloading new operator in c++
- by Angus
I have a code for best fit algorithm. I want to try to use the best fit algorithm using the operator new.
Every time I create an object I should give it from the already allocated memory say,
1]20 2]12 3]15 4]6 5]23 respectively. which ever minimum amount fits to the objects size(eg.21)
I wanted to do it for different object types, so I need to write the overloaded operator new to be common functionality for all the class objects.
Can I do it through friend functions, or is there any possible way to do it.