I'm not exactly clear on what abstract classes or interfaces are in Java, so please bear with me. I'm coding a chess game and I have a class Piece
and subclasses for each type of piece, ie. Knight
, Rook
, Pawn
, etc. I would like methods in my Piece class to be inherited into each subclass, some without new code being written in the subclasses (ie a "getX()" method) and some which will need new code (a "checkValidMove" for each piece).
I currently am extending the Piece class for each subclass, but I would like some input on if this is the best method for writing my code before I continue and go too far before I realize I should've written it differently.