Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualultramailman

Posted 03 February 2013 - 02:39 AM

Look at this signature:
bool Collision::BOP_Collision(sf::RenderWindow& App, const Player* const player = NULL, const Enemy* const enemy = NULL);
The player variable is of type
const Player * const
That means the pointer and the object it points should not be changed while in this function. So if you call a read-write (not const)method on player, the compiler will tell you it's an error. That's why the method should be declared as read-only (has that const on the right side).

It's a good idea to make a method const, if the method does not modify the object.

#1ultramailman

Posted 03 February 2013 - 02:37 AM

Look at this signature:
bool Collision::BOP_Collision(sf::RenderWindow& App, const Player* const player = NULL, const Enemy* const enemy = NULL);
The player variable is of type
const Player * const
That means the pointer and the object it points should not be changed while in this function. So if you call a read-write (not const)method on player, the compiler will tell you it's an error. That's why the method should be declared as read-only (has that const on the right side).

PARTNERS