I’m stuck in understanding of usable actors from survivable c++ example.
I have return Cast<AUsableItem>(Hit.GetActor());
.
I have class AUsableItem
. And I have another class AUsableWeapon
inherited from AUsableItem
.
I have function Use()
in both classes, so basically in the end it looks like Cast<AUsableItem>(Hit.GetActor())->Use()
. Hit.GetActor()
returns instance of AUsableWeapon
. And when i do that ->Use()
call, it goes into AUsableWeapon
even though it was casted to AUsableItem
. Problem is - I cant understand how exactly after casting to AUsableWeapon
I get Use()
called from AUsableWeapon
.