# Casting Actor class to child class derived from it?

**URL:** <https://forums.unrealengine.com/t/casting-actor-class-to-child-class-derived-from-it/393824>\
**Category:** C++\
**Tags:** bug, gameplay-tags, child-class, actor-blueprint, unreal-engine, Blueprint, question\
**Created:** [May 17, 2017, 9:43am UTC](https://forums.unrealengine.com/t/casting-actor-class-to-child-class-derived-from-it/393824 "2017-05-17T09:43:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![errur](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@errur](https://forums.unrealengine.com/u/errur)\
**Post date:** [May 17, 2017, 9:43am UTC](https://forums.unrealengine.com/t/casting-actor-class-to-child-class-derived-from-it/393824/1 "2017-05-17T09:43:38Z")

</div>

I’ve run into specific issue/a bug. I’ve created a new C++ class that extends the Actor class and implements the gameplay tags interface as in this tutorial ([Using GameplayTags | Shooter Tutorial](http://shootertutorial.com/2016/09/20/using-gameplaytags/)). The class is called TaggedActor.

I’ve found however that I can’t use the actor class returned from most functions (like GetOverlappingActors) with my TaggedActor, which is fine, however I can’t for the life of me figure out how to convert an actor to a tagged actor. I understand that you can’t cast parents to children due to missing functionality but I can’t even seem to find how to create a child, plug in all parent values from it and fill in the gaps myself.

Moreover, I have a loop that uses an array of tagged actors that I need to add objects from an array returned by GetOverlappingActors which does some checks and (when it works) adds them to an array of TaggedActors called \_actorsInSight. The problem here is that I can’t add the current loop object to the actors in sight array due to it expecting a taggedActor reference and not an actor reference, however, if I change the type of the \_actorsInSight array to actor, plug it in everywhere where necessary then change the type back to taggedActor (without it unplugging itself) it magically compiles and everything works. When I restart unreal however, it breaks the links and complains it’s incompatible again.

An image might help to illustrate my problem:

[https://puu.sh/vSFQk/a227fe2b34.png](https://puu.sh/vSFQk/a227fe2b34.png)

The main question though, is as in the title as it would cause me to avoid this problem altogether.
