473,505 Members | 16,940 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

new (static_cast<void*>(this)) TestClass(passedInt);

26 New Member
Hi All,

Can anybody tell me how the below statement executes.

class TestClass
{
int m_testValue;
public:
TestClass(int testVal)
{
m_testValue = testVal;
}

~TestClass() { }

void callBack(int passedInt)
{
new (static_cast<void*>(this)) TestClass(passedInt); //How this executes?
//What is the meaning for it?
}
};

Thanks,
Sendil
Jul 31 '08 #1
3 2392
Banfa
9,065 Recognized Expert Moderator Expert
Well it doesn't compile for me (in VS 2005 Express with MS extensions off), what compiler are you compiling it in?
Jul 31 '08 #2
Sendil kumar
26 New Member
I'm using Visual Studio 2005 Professional Edition Version 8.0.5
Aug 1 '08 #3
Banfa
9,065 Recognized Expert Moderator Expert
And does it compile without warning?
Aug 1 '08 #4

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.