Code example in the "Introduction to programming" documentation doesn't work

I’m trying to follow the documentation on programming but it gives me errors.

I see others have experienced the same issue in another forum post and used “virtual void” to fix it but this did not work either

This should go in the .h to declare it:

virtual void PostInitProperties() override;

and this in the .cpp to define it:

void AFloatingActor::PostInitProperties()
{
    Super::PostInitProperties();
    DamagePerSecond = TotalDamage / DamageTimeInSeconds;
}
3 Likes

Hi, thank you for your reply.

I tried adding here in the .h to declare it:

and here in the .cpp:

but it still causes errors:

It should be out of all { … }. Try and place it unter the closing {} of Tick().

2 Likes

Hey it’s working now, thank you for your help!! :slight_smile: