C
confused_newbie
CF app using VB.net
I want to build a class (data structure?) that is always of the same
size/structure, and will instantiate the class for each of my tabpages.
Purpose is to hold data related to attributes/properties (if I can ever get
those two straight in my head). This class/structure will not have a
physical interface, but will be manipulated through other objects/events.
I'm not building a chess game, but the logic for the data structure seems
similar, and is easier to describe
* chess or checkerboard (64 'objects'/cells; in a 8x8 array)
* each "cell" will have the same properties
-EmptyOrOccupied [boolean],
-OccupiedByPieceType [object; king,queen,etc],
-OccupiedByPieceColor [boolean; white or black]
-PriorPiecePosition [(a,b) reference to the 8x8 array],
-etc
Now imagine that I have 4 tabpages, and I want to create an instance of this
class for each (to maintain 4 separate chess games). I want to have
everything for each individual game as "lumped together" as possible to make
it easy to work with.
I started by creating a private class (EachCell) that has the public
properties listed above (EmptyOrOccupied, etc)
Then I create a new class (ChessBoard) that inherits EachCell and in it I
"dim MyGrid(7,7) as EachCell"- so presumably(?) ChessBoard contains an 8x8
grid where each element of the array has the cell properties, and I could
use this as a single chessboard.
Thats where I'm stuck- I want that to be my base class that I inherit for
_each_ tabpage, with a 8x8 grid for each. When I create a sub, and dim
ChessGame1 as new ChessBoard (to create an instance to use in tabpage1), I
only get the individual properties, not the 8x8 grid; e.g.
Panel1Grid.EmptyOrOccupied instead of
Panel1Grid.MyGrid(3,4).EmptyOrOccupied
what is the best way to set up this class?
Much thanks in advance,
Keith
I want to build a class (data structure?) that is always of the same
size/structure, and will instantiate the class for each of my tabpages.
Purpose is to hold data related to attributes/properties (if I can ever get
those two straight in my head). This class/structure will not have a
physical interface, but will be manipulated through other objects/events.
I'm not building a chess game, but the logic for the data structure seems
similar, and is easier to describe
* chess or checkerboard (64 'objects'/cells; in a 8x8 array)
* each "cell" will have the same properties
-EmptyOrOccupied [boolean],
-OccupiedByPieceType [object; king,queen,etc],
-OccupiedByPieceColor [boolean; white or black]
-PriorPiecePosition [(a,b) reference to the 8x8 array],
-etc
Now imagine that I have 4 tabpages, and I want to create an instance of this
class for each (to maintain 4 separate chess games). I want to have
everything for each individual game as "lumped together" as possible to make
it easy to work with.
I started by creating a private class (EachCell) that has the public
properties listed above (EmptyOrOccupied, etc)
Then I create a new class (ChessBoard) that inherits EachCell and in it I
"dim MyGrid(7,7) as EachCell"- so presumably(?) ChessBoard contains an 8x8
grid where each element of the array has the cell properties, and I could
use this as a single chessboard.
Thats where I'm stuck- I want that to be my base class that I inherit for
_each_ tabpage, with a 8x8 grid for each. When I create a sub, and dim
ChessGame1 as new ChessBoard (to create an instance to use in tabpage1), I
only get the individual properties, not the 8x8 grid; e.g.
Panel1Grid.EmptyOrOccupied instead of
Panel1Grid.MyGrid(3,4).EmptyOrOccupied
what is the best way to set up this class?
Much thanks in advance,
Keith