0

I came across this code but I couldn't understand it:

void *operator new(unsigned int some_variable) -> Here new is a function but I can't understand what void *operator is doing and here is the complete code:

int buf[3];   

void *operator new(unsigned int uiSize)
{
    return (void *)buf;
}
Jarod42
  • 173,454
  • 13
  • 146
  • 250
Agrudge Amicus
  • 869
  • 4
  • 16

1 Answers1

1

This is Operator Overloading that defines an implementation for the operator new and returns Void Pointer

For more information about overloading in C++, you can check this link.

C++ Overloading

Yomna Hesham
  • 382
  • 1
  • 13