This is code from the first person template.You can see that the spawnActor is passing a class created in c++ as the argument,but in game its spawning the blueprint class inherited from the c++ class,I want to achieve the same in my game but its spawning the c++ class.
const FRotator SpawnRotation = GetControlRotation();
// MuzzleOffset is in camera space, so transform it to world space before offsetting from the character
location to find the final muzzle position
const FVector SpawnLocation = ((FP_MuzzleLocation != nullptr) ? FP_MuzzleLocation
->GetComponentLocation() : GetActorLocation()) + SpawnRotation.RotateVector(GunOffset);
//Set Spawn Collision Handling Override
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride =
ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;
// spawn the projectile at the muzzle
World->SpawnActor<AMyProject2Projectile>(ProjectileClass, SpawnLocation, SpawnRotation, ActorSpawnParams);