Reputation: 6323
Not sure what to make of the following and how to use it? thx
class A;
typedef void (*CALLBACK)( A*, void* );
Upvotes: 0
Views: 78
Reputation: 8995
It is a type definition defining the type CALLBACK
as a function pointer to a function that returns void
and takes an A*
and a void*
as parameters.
typedef void (*CALLBACK)(A*, void*);
void cb(A*, void*);
CALLBACK handler = cb;
...
A* obj = new A();
some_type data;
handler(obj, &data);
Upvotes: 1
Reputation: 62439
It's a pointer to a function returning void
and taking an A*
and a void*
parameter. E.g.
void foo(A* a, void* v)
{
...
}
...
CALLBACK c = foo;
Upvotes: 1
Reputation: 5542
You are defining a pointer to a function that returns void
and takes an A *
followed by void *
. Thus you could do
void f(A*, void*);
CALLBACK cbk = f;
// ...
A* a;
void *p;
cbk(a, p);
Upvotes: 1