Java Super and Sub Classes
Ok so i've got a game, with class Player, and a few extensions of Player
i've greatly over simplified my code for ease of my typing.
Code:
class Player
public PlayerStuff;
class SmartPlayer extends Player
public SmartStuff;
class HumanPlayer extends Player;
Public HumanStuff;
then in my game class i'm trying to define an array of players that is a mix of players, smartplayers and humanplayers.
Code:
Player[NUM_OF_PLAYERS] PlayersInGame;
PlayersInGame[1] = new Player;
PlayersInGame[2] = new SmartPlayer;
and the problem arises that i cant access the methods in SmartPlayer even if instances of the array is pointed at a SmartPlayer... any ideas?