APawn provides no movement abilities , but ADefaultPawn inherited from APawn does. However, ADefaultPawn does not override APawn’s BeginPlay , Tick and SetupPlayerInputComponent . I created MyPawn inheriting APawn at first but then I found it has no movement ability . I decided to inherit MyPawn from ADefaultPawn but it popped overriding errors out –
member function declared with ‘override’ does not override a base class member
Can I override a method in superclass’ superclass ? I need BeginPlay method in ADefaultPawn
Hi,
If child class is not overriding functions from parent, it doesn’t mean you won’t be able to in the child’s child.
You will be able to, you just have to get the exact same function signature, and your class MyPawn will be overriding function from APawn, without any problem !
Do I need ‘override’ keyword ?
Hi, sorry for the dead late answer
Yes : basically when you want to override a function, you just copy/paste the exact same signature (choose to remove (or not) the keyword virtual
) and add the override word at the end. No matter where in the parenting the method is, you’ll always be able to override it.
If you get the error of type does not override a base class member
, it could just be that your function has not the EXACT same signature of the inherited one.