# \[C++\] How to get UClass from TSubClassOf\<\>?

**URL:** <https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067>\
**Category:** C++\
**Tags:** casting, tsubclassof, UClass, unreal-engine, CPP, question\
**Created:** [December 12, 2016, 12:51pm UTC](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067 "2016-12-12T12:51:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yarpoplar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yarpoplar](https://forums.unrealengine.com/u/yarpoplar)\
**Post date:** [December 12, 2016, 12:51pm UTC](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067/1 "2016-12-12T12:51:24Z")

</div>

Here is simple question. How to get UClass from TSubClassOf\<\>?  
For example I have

```
TSubClassOf<ACharacter> TalkActor;

```

But next code doesn’t works:

```
TalkActor->GetClass()

```

It’s returning not the right class, which I selected in editor.

---

<div class="post-metadata">

**Author:** ![yarpoplar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yarpoplar](https://forums.unrealengine.com/u/yarpoplar)\
**Post date:** [December 12, 2016, 2:27pm UTC](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067/2 "2016-12-12T14:27:23Z")

</div>

Figured by myself.  
I can just dereference it back with

```
 (*TalkActor)
```

---

<div class="post-metadata">

**Author:** ![Arty-McLabin](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arty-mclabin/32/1012076_2.png) [@Arty-McLabin](https://forums.unrealengine.com/u/Arty-McLabin)\
**Post date:** [March 12, 2018, 1:38am UTC](https://forums.unrealengine.com/t/c-how-to-get-uclass-from-tsubclassof/379067/3 "2018-03-12T01:38:18Z")

</div>

Please use this instead:

```
TSubClassOf<ACharacter> talk_actor_subclass;

talk_actor_subclass.Get(); //returns UClass*
```
