L
Luc The Perverse
I haven't actually written this yet, I'm just making some plans. This will
be my second or third "real" project in Java (I don't count tutorials,
experiments, etc.)
Where I get confused is where to put the intelligence, where to put the
drawing algorithms.
CCheckersStyleGameBoard inherits CGameBoardStyle
CChessGame inherits CGameManager
CChessPiece inherits CPiece
(Same thing for COthelloStyleGameBoard, CPenteGame, CPentePiece.)
Obviously the GameManager is going to create the CGameBoardStyle and give it
parameters, Black And White Squares 8 by 8. It is going to create the
CChessPiece objects and "place" them on the board somehow.
The CGameBoardStyle derived class is going to draw itself, and based on
coordinated determine the size and location of the pieces to be placed on
the board. Abstract function CPiece.Draw will be called for each piece,
with size and location information passed from the calling CGameBoardStyle
class. (I feel semi confident about this.)
Now I read that Java doesn't support multiple inheritance. Does this mean a
class cannot be derived from both JPanel and CGameBoardStyle? Or is this
where the "implements" keyword comes into place. (If so it would seem Java
~does~ support some form of multiple inheritance, but only one class can
contain functions which are not purely virtual.)
Well that is my plan - any advice is welcome
be my second or third "real" project in Java (I don't count tutorials,
experiments, etc.)
Where I get confused is where to put the intelligence, where to put the
drawing algorithms.
CCheckersStyleGameBoard inherits CGameBoardStyle
CChessGame inherits CGameManager
CChessPiece inherits CPiece
(Same thing for COthelloStyleGameBoard, CPenteGame, CPentePiece.)
Obviously the GameManager is going to create the CGameBoardStyle and give it
parameters, Black And White Squares 8 by 8. It is going to create the
CChessPiece objects and "place" them on the board somehow.
The CGameBoardStyle derived class is going to draw itself, and based on
coordinated determine the size and location of the pieces to be placed on
the board. Abstract function CPiece.Draw will be called for each piece,
with size and location information passed from the calling CGameBoardStyle
class. (I feel semi confident about this.)
Now I read that Java doesn't support multiple inheritance. Does this mean a
class cannot be derived from both JPanel and CGameBoardStyle? Or is this
where the "implements" keyword comes into place. (If so it would seem Java
~does~ support some form of multiple inheritance, but only one class can
contain functions which are not purely virtual.)
Well that is my plan - any advice is welcome