P
Paul
James Kanze said:[...]
I can understand the concept you express but
a) how do you get the address of a member function?
&ClassName::functionName
Concretely:
struct C { void f(); };
void (C::*pf)() = &C::f;
b) what happens if this member function is virtual?
It works correctly. That's why pointer to member functions are
often larger than any other pointer types (but there are other
ways of solving the problem).
What would your pointer point to ?
That's the compiler writers problem, not mine.It certainly is a problem for the compiler, and perhaps the
program too. Especially if you didn't initialised the empty
pointer. Let me put it another way, where would you get the
address for the virtual function?
From the object you call the pointer on.
Then you are calling the function on an object.
You can't have a virtual function without an object ,end of story.
The fact that you cannot provide code to suggest what you claimed proves theYour guarantees aren't worth much, since you obviously aren't
familiar with C++. It does work, and I've done it. Several
types, with different compilers (Sun CC, g++ and VC++, at
least---although you need special compiler options with VC++ if
everything isn't in the same translation unit).
opposite. And it suggests that your claims are pretty weak and innaccurate.