You are on right track with the AddDynamic(…). However, parameters of the function passed in matter, thus getting it to work would require OnPickup() to be something like:
Using OnComponentBeginOverlap:
// In constructor
PickupMesh->OnComponentBeginOverlap.AddDynamic(this, &APickup::OnPickup);
// The method itself (Note the parameters)
void APickup::OnPickup(AActor* OtherActor, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("PICKED UP!")));
}
Or using OnActorBeginOverlap
// In constructor:
OnActorBeginOverlap.AddDynamic(this, &AHealth::OnPickup);
// Method itself (Note the parameters)
void AHealth::OnPickup(class AActor* OtherActor)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("PICKED UP!")));
}