Example below is not working, but it illustrates what I want to get
I know that templates are not supported for UClass, but I’m searching for some version of cast which accepts uclass as a function parameter or any other workaround
class Foo {
FString Name;
}
TSubClass<Foo> Bar;
TArray<Foo> arr;
FString Name = Cast<Bar.Get()>( arr[i] ).Name;
Thats not possible, C++ types only exist in compile time and it’s only used to construct machine code, they are not dynamic in anyway. Same goes with templates.
Also i don’t really understand why you want to do this looking on the code, you expect type Foo to have a property Name… why you casting it then?
You might also look in to interfaces which solves lot of class relation problems