What does -> mean?

I’m following along the updated Battery Collector series, and currently on video #5. There is one line in the video that I do not understand. In the ABatteryPickup class that inherits from APickup, in the constructor ABatteryPickup::ABatteryPickup() there is one single line:


So I hopped up on Unreal Docs and GetMesh() and SetSimulatePhysics() are both understandable. What I don’t understand is the -> operator. What does it do?

“->” is called “Member Access” and in the simplest terms it allows you to access members of the object referencedy the pointer.


If YourClass has the following properties:

// A float variable
float MyClassFloat;
// A function that returns nothing and takes no parameters
void MyClassFunction();

and you have a pointer to an instance of YourClass, e.g.

YourClass* PointerToInstanceOfYourClass;

You can access the float variable and the function belonging to YourClass:

// Set variable
PointerToInstanceOfYourClass->MyClassFloat = 5.0f;

// Execute function

It is analogous to the “.” operator, but for pointers.