Rabu, 25 Januari 2017

How to overload new and delete operators in C++ Programming

C++ allows programmers to overload new and delete operators due to following reasons: To add more functionality when allocating or deallocating memory. To allow users to debug the program and keep track of memory allocation and deallocation in their programs.   Syntax for overloading new operator is as follows: void* operator new(size_t size);   Parameter size specifies the size of memory to be allocated whose data type is size_t. It returns a pointer to the memory allocated.   Syntax for overloading delete operator is as follows: void operator delete(void*);   The function receives a parameter of type void* and returns

The post How to overload new and delete operators in C++ Programming appeared first on Coding Security.


How to overload new and delete operators in C++ Programming
read more

Tidak ada komentar:

Posting Komentar