for examplethere are chess pieces in our chess setbut there are only six different types of pieces (pawnsrooksbishopsknightskingand queen)each of which behaves differently when it is moved all of these classes of piece have propertiessuch as color and the chess set they are part ofbut they also have unique shapes when drawn on the chess boardand make different moves let' see how the six types of pieces can inherit from piece classpawn rook +shape +shape piece +move(board+move(board+chess_setchessset +color bishop queen +shape +shape +move(board+move(boardknight king +shape +shape +move(board+move(boardthe hollow arrows indicate that the individual classes of pieces inherit from the piece class all the subtypes automatically have chess_set and color attribute inherited from the base class each piece provides different shape property (to be drawn on the screen when rendering the board)and different move method to move the piece to new position on the board at each turn we actually know that all subclasses of the piece class need to have move methodotherwisewhen the board tries to move the pieceit will get confused it is possible that we would want to create new version of the game of chess that has one additional piece (the wizardour current design allows us to design this piece without giving it move method the board would then choke when it asked the piece to move itself we can implement this by creating dummy move method on the piece class the subclasses can then override this method with more specific implementation the default implementation mightfor examplepop up an error message that saysthat piece cannot be moved