How virtual methods work as method_implementation()?


I started to learn UE4 this week. By the way I am learning C++ basics at the same time so this question can be related to C++ not UE4.

In tutorial of battery collector, author uses virtual methods in parent class to enable children classes to override it.

So it is like that.


void WasCollected();	
virtual void WasCollected_Implementation();


//no implementation for WasCollected method.

 void APickup::WasCollected_Implementation()
	//Some implementation code


	void WasCollected_Implementation() override;


void ABatteryPickup::WasCollected_Implementation()

	//Some code overriding parent method.

In another class whole functionality is made by calling WasCollected method even it is just declared header file of parent.

So how is it works. Is _Implementation special key word or something like that for overriding methods. Because as I am looking this code, it shouldn’t work.

I assume it’s somehow related to exposing C++ functions to blueprints via reflection.
check out this link: Introduction to C++ Programming in UE4 | Unreal Engine Documentation

especially, this paragraph:
“This version still generates the thunking method to call into the Blueprint VM. So how do you provide the default implementation? The tools also generate a new function declaration that looks like _Implementation(). You must provide this version of the function or your project will fail to link. Here is the implementation code for the declaration above.”