0

I'm starting to study Unreal Engine and I saw this code:

UCLASS()
class AMyPlayerController : public APlayerController
{
    GENERATED_BODY()

    void SetupInputComponent()
    {
        Super::SetupInputComponent();

        InputComponent->BindAction("Fire", IE_Pressed, this, &AMyPlayerController::HandleFireInputEvent);
        InputComponent->BindAxis("Horizontal", this, &AMyPlayerController::HandleHorizontalAxisInputEvent);
        InputComponent->BindAxis("Vertical", this, &AMyPlayerController::HandleVerticalAxisInputEvent);
    }

    void HandleFireInputEvent();
    void HandleHorizontalAxisInputEvent(float Value);
    void HandleVerticalAxisInputEvent(float Value);
};

I've understood everything but this line:

InputComponent->BindAction("Fire", IE_Pressed, this, &AMyPlayerController::HandleFireInputEvent);

What is the fourth parameter? I'm new to C++ but I've studied the basics of C while in college. What I can't understand is the "::". I know that the "&" means that the parameter is a pointer to the memory address of MyPlayerController, but what about the double points? I assume that I'm passing as fourth parameter the HandleFireInputEvent function of the MyPlayerController class but I would like to know more about you. Many thanks.

wohlstad
  • 12,661
  • 10
  • 26
  • 39
Allennick
  • 445
  • 2
  • 10

1 Answers1

1

The fourth argument is the address of a class member function. And that function has a name within the class scope, just as when you have to implement a class member.

Pepijn Kramer
  • 9,356
  • 2
  • 8
  • 19