hello guys, how can I call this restartplayer in another class?
.h
virtual void RestartPlayer(class AController* NewPlayer) override;
.cpp
void ASCoopGameMode::RestartPlayer(class AController* NewPlayer)
{
if (!bSpawnAtTeamPlayer || (NewPlayer->PlayerState && NewPlayer->PlayerState->IsABot()))
{
	Super::RestartPlayer(NewPlayer);
	return;
}
FVector SpawnOrigin = FVector::ZeroVector;
FRotator StartRotation = FRotator::ZeroRotator;
for (TActorIterator<APawn> It(GetWorld()); It; ++It)
{
	ASCharacter* MyCharacter = Cast<ASCharacter>(*It);
	if (MyCharacter && MyCharacter->IsAlive())
	{
		/* Get the origin of the first player we can find */
		SpawnOrigin = MyCharacter->GetActorLocation();
		StartRotation = MyCharacter->GetActorRotation();
		break;
	}
}
/* No player is alive (yet) - spawn using one of the PlayerStarts */
if (SpawnOrigin == FVector::ZeroVector)
{
	Super::RestartPlayer(NewPlayer);
	return;
}
/* Get a point on the nav mesh near the other player */
FNavLocation StartLocation;
UNavigationSystemV1* NavSystem = UNavigationSystemV1::GetNavigationSystem(this);
if (NavSystem && NavSystem->GetRandomPointInNavigableRadius(SpawnOrigin, 250.0f, StartLocation))
{
	// Try to create a pawn to use of the default class for this player
	if (NewPlayer->GetPawn() == nullptr && GetDefaultPawnClassForController(NewPlayer) != nullptr)
	{
		FActorSpawnParameters SpawnInfo;
		SpawnInfo.Instigator = GetInstigator();
		APawn* ResultPawn = GetWorld()->SpawnActor<APawn>(GetDefaultPawnClassForController(NewPlayer), StartLocation.Location, StartRotation, SpawnInfo);
		if (ResultPawn == nullptr)
		{
			UE_LOG(LogGameMode, Warning, TEXT("Couldn't spawn Pawn of type %s at %s"), *GetNameSafe(DefaultPawnClass), &StartLocation.Location);
		}
		NewPlayer->SetPawn(ResultPawn);
	}
	if (NewPlayer->GetPawn() == nullptr)
	{
		NewPlayer->FailedToSpawnPawn();
	}
	else
	{
		NewPlayer->Possess(NewPlayer->GetPawn());
		// If the Pawn is destroyed as part of possession we have to abort
		if (NewPlayer->GetPawn() == nullptr)
		{
			NewPlayer->FailedToSpawnPawn();
		}
		else
		{
			// Set initial control rotation to player start's rotation
			NewPlayer->ClientSetRotation(NewPlayer->GetPawn()->GetActorRotation(), true);
			FRotator NewControllerRot = StartRotation;
			NewControllerRot.Roll = 0.f;
			NewPlayer->SetControlRotation(NewControllerRot);
			SetPlayerDefaults(NewPlayer->GetPawn());
		}
	}
}
}