Technical Discussion :: C++
Home > Freshers > Technical Interview Questions > C++
8. Explain overloading the delete operator.
Answer:
Syntax:
void operator delete(void *p)
{
/*free memory pointed to by p. the destructor is called automatically.*/
}
The delete function receives a pointer to the region of memory to be freed. It then releases the previously allocated memory back to the system. When an object is deleted, its destructor is automatically called.
Asked In :: TCS Societe Generale
Syntax:
void operator delete(void *p)
{
/*free memory pointed to by p. the destructor is called automatically.*/
}
The delete function receives a pointer to the region of memory to be freed. It then releases the previously allocated memory back to the system. When an object is deleted, its destructor is automatically called.
void operator delete(void *p)
{
/*free memory pointed to by p. the destructor is called automatically.*/
}
The delete function receives a pointer to the region of memory to be freed. It then releases the previously allocated memory back to the system. When an object is deleted, its destructor is automatically called.