0
Delete and new implementation
how new and delete are defined If we do not overload new or delete globally , it works and if it was overloaded, global functions defined by us are used when we allocate memory for any data type(basic or custom). If we overload new or delete inside class , these are called when new or delete on same class object is done. How C++ has done this possible in original code of new or delete operator. Any hint or good material is most welcome. Just curious how to implement this functionality by us for some different operator.
2 odpowiedzi
+ 1
https://cplusplus.com/doc/tutorial/
see inside classes, if there is what you need....
https://www.geeksforgeeks.org/new-and-delete-operators-in-cpp-for-dynamic-memory/
In C++, the new operator is used to allocate memory dynamically on the heap, while the delete operator is used to deallocate that memory when it is no longer needed. This helps manage memory efficiently and prevents memory leaks by ensuring that every allocation with new has a corresponding delete to free the memory. [Duck.AI : search = cpp new delete]
I hope this helps
0
I am more concerned about resolution order of function call for this operators