C++ to BP Translation - Class vs Object Reference Question

I’ve been learning quite a bit about C++ and BP by converting C++ functions from ShooterGame into Blueprints.
For example:

Hopefully, that makes it clear what I’m doing.

I’m having trouble determining when to use a Class reference or a Object reference:

Here’s the code for the function I was trying to convert:

On line 622 you can see the parameters for the function include the ‘class’ keyword, so I would expect in Blueprint I would want to use class references.

I’ve experimented with both:

If I use Class reference variables in the Blueprint, I run into issues once I get to line 638: ‘LocalLastWeapon->OnUnEquip();’
I can’t seem to call member functions from a class reference variable.

If I go with using Object references, there doesn’t seem to be a non-hacky way of setting an object reference to Null.
(In the picture above, I worked around this by creating a second variable of the same type)

Any suggestions as to which is the correct one to use?

Thank you.

No, the class keyword in this case is used to let the compiler know that the word AShooterWeapon is a class type, this is called a forward declaration. The parameters NewWeapon and LastWeapon are pointers to instances of AShooterWeapon, the equivalent in BP would be object references. In this particular case the forward declaration is actually pointless because the pointers passed into the method are dereferenced, which means the full declaration must be available at that point or the compiler will throw up an error.

And for future reference, the C++ equivalent of a BP class reference is UClass* or TSubclassOf<USomethingOrASomething>.

You just create a new SET node for the variable and leave it at that, by default it will set an object reference to None if you don’t specifically set it to something else.

Brilliant! Very helpful, thank you.