Discussion:
operator new overloading
(too old to reply)
Alamelu
2008-09-23 18:27:01 UTC
Permalink
I have overloaded a new operater for a class that returns void * and i have
created an object for that class in heap as below.

CMyClass *pMyClass = new CMyClass(); // Here though i haven't explicitly
casted void* to CMyClass, the compiler doesnt give error at all.

But in c++ for void* to specific type ptr , explicite cast is required. What
was the cause for the above statement to work?

Regards,
Alamelu
Dan Freeman
2008-09-23 20:19:50 UTC
Permalink
I dunno, but it would sure throw an exception in Visual FoxPro which is the
subject of this newsgroup. ;-)

Dan
Post by Alamelu
I have overloaded a new operater for a class that returns void * and
i have created an object for that class in heap as below.
CMyClass *pMyClass = new CMyClass(); // Here though i haven't
explicitly casted void* to CMyClass, the compiler doesnt give error
at all.
But in c++ for void* to specific type ptr , explicite cast is
required. What was the cause for the above statement to work?
Regards,
Alamelu
Loading...