小编far*_*ari的帖子

是否可以使用多态中的超类对象访问子类的变量

如何使用类KeyBoardPlayer的对象访问类的状态变量KalaPlayer

/**
  * An abstract class representing a player in Kala.  Extend this class
  * to make your own players (e.g. human players entering moves at the keyboard
  * or computer players with programmed strategies for making moves).
  */
public abstract class KalaPlayer {

    /**
      * Method by which a player selects a move.
      * @param gs The current game state
      * @return A side pit number in the range 1-6
      * @throws NoMoveAvailableException if all …
Run Code Online (Sandbox Code Playgroud)

polymorphism subclass superclass

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

polymorphism ×1

subclass ×1

superclass ×1