I want a operation in one of my classes (Snake) to be able to use the attributes of another class (food), so I want to declare that operation as a friend of food.
I'm still new and have never used friend before.
is this the right declaration for the operation?
if not, where have I went wrong?Code:friend void food::check_collision( );
also, when I come to implement and call on check_collision, will i always have to put 'food' in front of it? making is Snake::food::check_collision, or will it still be Snake::check_collision ?
Update:: Ok, I'm fine on the declaration now, but would still like confirmation when it comes calling the operation
thanks for the help