title: Accessing and changing a class member function from another class
body: <p>I have three classes I am trying to link together for my game. I am trying to make it so that if Player1 steps on a specific type of Tile then Player1's gravity variable "AccelY" will change providing the effect of a lift and raising the player up vertically. An initilisation class creates object Player1. (There is only one player so this can be applied to the whole class) This includes header files for CEntity.h and CPlayer.h via CApp.h the main controller class. The CPlayer class is a child class of CEntity. Accel Y is declared publicly in CEntity as a float with no initial value. I want to change it in CPlayer when the player is on that type of tile. I have put an if statement clause in the Tile.h file but i cannot access and update the value using the following code? I initially tried by using the default class constructor but have tried with a function as below.</p>
  
  <p>CTILE.CPP</p>
  
  <pre><code>#include "CTile.h"
  #include "CPlayer.h"
  
  CTile::CTile(){
  
      TileID = 0;
  
      TypeID = TILE_TYPE_NONE;
  
      if(TypeID == TILE_TYPE_LIFT){   
  
          CPlayer::LiftTile(0.75f, 10.0f);
          //CPlayer::AccelY = 0.75f;
          //CPlayer.SpeedY = 2.0; 
      }
  }
  </code></pre>
  
  <p>CPLAYER.H</p>
  
  <pre><code>public:
  
      CPlayer();
  
      void LiftTile(float x, float y);
  </code></pre>
  
  <p>CPLAYER.CPP</p>
  
  <pre><code>void CPlayer::LiftTile(float x, float y){
  
      SpeedY = x;
      AccelY = y;
  }
  </code></pre>