A
Aaron
I want to build two abstract base classes.
1) Game
2) Position
The Game object represents a boardgame in its entirety and the
Position object represents individual game states. The Game object
will contain an array of Position objects representing the history of
the game. Each specific game will be expressed as a derivative of
these two classes. What I want to do is declare the base class array
in such a way that the derived classes don't have to redeclare this
array every time to the correct type.
This question of course stems from a lack of experience I have with C+
+ and many years of experience with scripting where typing is just not
an issue. My understanding is that in the base class I could declare
this array like this:
vector<Position> pos_hist
But my meager understanding also tells me that the derivative class
Chess::Game would then have to redeclare this member as:
vector<Game:
osition> pos_hist
Is there a way to make this redeclaration unnecessary, even if the
derived Position classes will almost certainly have to add new members
and methods?
Thank you for your time and patience.
1) Game
2) Position
The Game object represents a boardgame in its entirety and the
Position object represents individual game states. The Game object
will contain an array of Position objects representing the history of
the game. Each specific game will be expressed as a derivative of
these two classes. What I want to do is declare the base class array
in such a way that the derived classes don't have to redeclare this
array every time to the correct type.
This question of course stems from a lack of experience I have with C+
+ and many years of experience with scripting where typing is just not
an issue. My understanding is that in the base class I could declare
this array like this:
vector<Position> pos_hist
But my meager understanding also tells me that the derivative class
Chess::Game would then have to redeclare this member as:
vector<Game:
Is there a way to make this redeclaration unnecessary, even if the
derived Position classes will almost certainly have to add new members
and methods?
Thank you for your time and patience.