Why overloaded new operator is implicitly static and how we are able to allocate memory by calling overloaded new operator without scope resolution operator?
In my view if something is static then we can call it in main by through class name.
class xyz
{
void* operator new (size_t size); //implicitly declared static
void operator delete (void *p); //implicitly declared static
};
int main()
{
C *p = new C;
delete p;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…