Add virtual function to all aactor class?

Hi, i’m working on a game that something like strategy game.
and i have a trouble while designing architecture of my game

since it is based on mouse click and drag to select unit or order to unit, i think i need a superior class for them which have basic information of that unit.
for example, if i drag for select group of soldier unit, there can be some buildings or enemies laying on area i dragged.
and then i need some kind of sorting work to only pick my soldiers.
and for that work, i need to figure out which Actor is which one(My Soldier? Ally Soldier? Enemies? or building? etc…).

and for figure out, i need a variable that distinguish actor’s type.

i thought i just need to make a class from AActor than i can make child from that class.
but i found that APawn class is child of AActor and there might be more classes that children of AActor.
since that, i have to choose between make my own pawn class from my custom base class or forgive about my custom base class that child of AActor.

but i really don’t like both option, so i am looking for some solution that i can use all AActors children’s utilities and my custom base class that have my custom variables and functions.

just after i posted my question, i may can add data storage component for all of actors for store actor’s type or ally information things.
but i think that would be very inefficiency and can’t make function that individual class can’t override for custom behavior.
i really hope there will be some fancy (and efficient) way to solve this problem