I have a function pointer variable in my AItem class, which looks like this: ‘void (AItem::*MyPointer)()’.
In the AItem it works just fine, I can assign it (MyPointer = &AItem::MyFunction) and call it (MyPointer()).
But I cannot assign it in subclasses like (MyPointer = &AItemSubclass::MySubclassFunction).
Is it possible to have a function pointer which works for subclasses as well?
Would it maybe work if I use a similar setup like the SetTimer function?
I had a look at the source code of this function, but I couldn’t figure out how to transfer this to my own class.
I need to have a function that takes any function (of a class tree) and stores it in a variable, so I can call it later on.
//The actual functions which are implemented in subclasses
//or this class itself
virtual void PlayBehavior_Idle_LookLeftToRight();
virtual void PlayBehavior_Idle_LookFullCircle();
virtual void PlayBehavior_Idle_ScanUpDown();