Wie kann ich so etwas:
Code: Alles auswählen
struct A {
int x
int y
bool ok
Bool (*p_Deactivator)(struct A *) ;Zeiger auf eine Funktion!!!
}
struct B {
Vector2 a
Vector2 b
bool ok
Bool (*p_Deactivator)(struct A *) ;Zeiger auf eine Funktion!!!
}
A * Object_New(Bool (*deactivatorFunc)(struct A *))
{
A *p = calloc(1, SizeOf(A));
//...
if(deactivatorFunc != NULL) {
p->p_Deactivator = deactivatorFunc
}
}
void Object_Update(A *p, float value)
{
//..
if(p->p_Deactivator(p)) { ; Wie kann ich das hier am besten in PureBasic umsetzen?
p->ok = false;
return
}
//..
}
Beispiele?