Must explicitly invoke another constructor

后端 未结 6 1058
借酒劲吻你
借酒劲吻你 2021-01-25 03:27

Why is Eclipse keeps giving me error on the constructor:

 public DenseBoard(Tile t[][]){
      Board myBoard = new DenseBoard(t.length, t[0].length);
  }
         


        
6条回答
  •  太阳男子
    2021-01-25 03:50

    I think you DenseBoard class should implement all the Board class's abstract method. such like this:

    package Game2048;
    public class DenseBoard extends Board {
    
      public DenseBoard(int rows, int cols){
          super(rows, cols);
      }
    
      public DenseBoard(Tile t[][]){
          Board myBoard = new DenseBoard(t.length, t[0].length);
      }
    
      public Board copy(){
    
      }
    
      public int getRows(){
    
      }
    
      public int getCols(){
    
      }
    
      public int getTileCount(){
    
      }
    
      public int getFreeSpaceCount(){
    
      }
    
      public Tile tileAt(int i, int j){
    
      }
    
      public boolean lastShiftMovedTiles(){
    
      }
    
      public boolean mergePossible(){
    
      }
    
      public void addTileAtFreeSpace(int freeI, Tile tile){
    
      }
    
      public int shiftLeft(){
    
      }
    
      public int shiftRight(){
    
      }
    
      public int shiftUp(){
    
      }
    
      public int shiftDown(){
    
      }
    }
    

提交回复
热议问题