How would I cast this with reinterpret_cast? I tried the following without success;Code:return ((Foo*)bar)->func();
Code:return reinterpret_cast<Foo*>(bar)->func();
Printable View
How would I cast this with reinterpret_cast? I tried the following without success;Code:return ((Foo*)bar)->func();
Code:return reinterpret_cast<Foo*>(bar)->func();
I'd say that that depends on what is the type of bar, and how it is related to Foo.
And what does the extra parentheses do in the first snippet?
So that the cast applies to bar, not bar->func().Quote:
Originally Posted by Tux0r
Ok ;)
I'm gonna try solving the problem again...
edit: Didn't work so I just put a static_cast there... I still don't get why reinterpret_cast didn't work though.
Maybe you need dynamic_cast or const_cast? Without knowing what the types are and how they're related, it's hard to say.