Announcement

Collapse
No announcement yet.

Problem with typecasting using 'Cast'

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    The compiler is giving you the wrong error because it thinks you're trying to take the address of the Cast<> function itself, rather than call it. You forgot the parentheses around the Cast<ATeamPlayer>(Player).

    Edit: You figured it out while I was typing the post, good job.

    Leave a comment:


  • replied
    Never mind. Found the problem. Missing ( ) around Player.

    Leave a comment:


  • started a topic Problem with typecasting using 'Cast'

    Problem with typecasting using 'Cast'

    I'm working on creating team-based spawn points and I've written a new overloaded ChoosePlayerStart() function. The function needs to typecast the input Player parameter to my derived Team Player class.

    The code is as follows:

    Code:
    AActor *AMyGameMode::ChoosePlayerStart (AController *Player)
    {
       ATeamPlayer *TeamPlayer = Cast<ATeamPlayer> Player;
    
    ...blah...
    The compiler complains about the typecast with "error: address of overloaded function 'Cast' does not match required type of 'ATeamPlayer' ". ATeamPlayer is derived from ACharacter. What's wrong?
Working...
X