There is a class A and its descendants A1 , A2 , A3 , A4 , A5 , etc. There is also a class B , in which there must be a function F , which returns an array with names / pointers to A1 , A2 , A3 , A4 , A5 ...
An important rule: you cannot create objects of classes A1 , A2 , A3 , A4 , A5 before this function F is called from class B
Essentially (although this no longer concerns the task), in this function of class B will be the second function K , which will create objects by pointers from an array, returned to it from F
This is the task I met in practice. Google unfortunately does not understand me (or I him).
Note
.H
TSubclassOf<YourClass> BlueprintVar; // YourClass is the base class that your blueprint uses .CPP
ClassThatWillSpawnTheBlueprint::ClassThatWillSpawnTheBlueprint(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) { static ConstructorHelpers::FObjectFinder<UBlueprint> PutNameHere(TEXT("Blueprint'/Path/To/Your/Blueprint/BP.BP'")); if (PutNameHere.Object) { BlueprintVar = (UClass*)PutNameHere.Object->GeneratedClass; } }