Class B;
B *b = new B(); // default constructor
B *b1 = new B(10); // constructor which takes an argument B(int x)
However, if we want to write a custom version of new, the syntax is
Class B
{
/*...*/
static void* operator new(size_t size);
}
How is the statement new B() converted to a function call for
operator new(sizeof(B))?
And how does it keep track of which constructor to call i.e. how does it distinguish between new B() and new B(int x)?
Is new implemented as a macro in C++?