I've an abstract interface
I by which
virtual void Foo() is determined, together with other functions. You will find some subclasses by which
Foo is re-defined, yet others by which
Foo isn't. Now, given
I* pi, can you really know whether
Foo is re-defined? That's, I wish to know whether
pi->Foo() would call
X is a few key in which
Foo is re-defined. I believe you can do this by evaluating function pointers, between
&pi->Foo, although not sure just how to. Observe that I'm not sure the concrete kind of
pi in runtime, and so i cannot compare function pointers directly by
&I::Foo != &X::Foo.
So, many people pointed the design isn't good, against the idea of abstraction and virtual functions. The primary reason why I am carrying this out would be to bypass empty function calls to enhance speed. Since a number of
Foo() are empty, I must take it out of a vector of
Foo() is empty.
You cannot discover from
&pi->Foo, since, because the GCC error message will explain,
ISO C++ prohibits using the address of the bound member function to create a pointer to member function.
If you wish to know the kind of an item at runtime, use
typeid. Otherwise, re-think your design.
You are able to
dynamic_cast your pointer to each one of the child types that overrides
Foo and when it's among individuals types it'll call the kid. You cannot go ahead and take address of the member function while using
-> syntax you need to use.
But all nevertheless I'd really re-think your design before doing something similar to this. The purpose of connects and virtual techniques would be to avoid the necessity to understand what type you are coping with!