I have the following class model:
sealed abstract class Tile(val coordinate: Int, val isOccupied: Boolean) {
def isEmpty() : Boolean
def getPiece() : Option[Piece]
}
case class EmptyTile(coordinate: Int) extends Tile(coordinate, false) {
override def toString: String = "" +coordinate
override def isEmpty() = true
override def getPiece() = None
}
case class OccupiedTile(coordinate: Int, val piece: Piece) extends Tile(coordinate, true) {
override def toString = piece.toString
override def isEmpty = false
override def getPiece = Some(piece)
}
and I get the following error:
Error:(6, 22) overriding value coordinate in class Tile of type Int;
value coordinate needs `override' modifier
case class EmptyTile(coordinate: Int) extends Tile(coordinate, false) {
^
What am I doing wrong?
EDIT: Request to see Piece class, adding here:
import Alliance.Alliance
import PieceType.PieceType
abstract class Piece(val piecePosition: Int, val pieceType : PieceType, val alliance: Alliance) extends Movable {
}
object PieceType extends Enumeration {
type PieceType = Value
val PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING = Value
}