Object's method as a callback method
Posted on 2000-05-07
It there a way to use object's method as
a callback method if I don't know what type
of that object is? Is there any other way
than to use normal non class method,
i.e. normal function as a callback function.
void foo(void *pObject)
object = (SomeClass *) pObject;
If I know pObject is type of SomeClass,
I can cast it with no problems. But what
if I don't know the type? Is there a way
to find out this type or pass it as a variable?
Why I'm asking this, is because I have
class library which uses this callback method.
So far I have defined that "User must give
pointer to object which implements
method called "foo()". I can't say that
"User must implement class which name
is X and implement a method foo there",
because most of the time users of the
class library would have to make this
class just for that one method.