Compare class method to function pointer
I have a base class (ThinkFunc) that other classes inherit from. Func() is
a virtual void method.
I want to be able to determine the type of class, so I thought it would be
quick and easy to see what method the Func() pointed to. So I'm trying to
compare the function pointers. But apparently the code below is not
allowed. Is there a way to do this in C++ with subclassed virtual
functions?
bool found = false;
ThinkFunc *tfNode;
for (tfNode = this->thinkfuncs; tfNode; tfNode = (ThinkFunc*)tfNode->next)
{
if (tfNode->Func == &Thinkers::GroupBoxBouncePan::Func)
{
found = true;
break;
}
}
No comments:
Post a Comment