I'm looking for a bit of semantics help. I know what I want to do, but don't know what its called so I can't really learn how to do it :P
I have four classes:
PlayerSnake and AISnake are derived classes of Snake. The food class needs to be able to access some of the attributes of PlayerSnake and AISnake (the coordinates of there first nodes).
Is there a way to have a class access another attributes without inheritance? if so what's this called?
will a simple 'get_x' and 'get_y' work? if so, what would go into those functions?
thanks for the help, I'm still quite new to coding
How about a Snake method called 'snake::eats(position)', which returns true if the snake is able to eat at the indicated position?