shameless self-promoting website
»Rejourn root
Posted Tuesday, 31 March 2009 by Miklos
Tags: en hacking

Okay, I learned something new, you can have a special pointer type in C++ which is not really a pointer at all.

So let's say you have a Foo class with a lot of void foo(int param); methods. Then you can have a "pointer" type 'int (Foo::*)(int)' which is in fact a pointer to Foo and it has an offset about what function does it point to.

And given that it contains an address and an offset as well, you can't cast it to void*, like you can do so with real pointers.

I had to look up the Bjarne book since I didn't really know about this at all... ;-)