How to "override" a variable from a parent class?

I know this is a pretty stupid question, and it probably belongs on a generic C++ forum, but I’m not sure how to search for this. I have a board game with different pieces. Each piece has its own class which is a child of a “parent piece” class. I want this parent piece class to have a variable that can be overridden for each child piece. For example, each piece has its own “armor” variable value, so that I can cast to any piece and read ITS armor value. How could I do this?

Thanks in advance!

If each piece is a child of the parent piece, then it will automatically have all the variables that are declared in the parent classes.

Once you have a reference, you can do something like this

float ArmorValue = ChildClassReference->ArmorVariable;

if this didn’t answer your question, post more info and screenshots if you can

1 Like

For anyone else stumbling across this in the future, you can set the inherited variables by going into the class defaults of the blueprint and you can set them in the details panel from there.