Agrudge Amicus
Agrudge Amicus

Reputation: 1103

return type of a function

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;
}

Upvotes: 0

Views: 101

Answers (1)

Yomna Hesham
Yomna Hesham

Reputation: 472

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

Upvotes: 1

Related Questions