S
samumatt
Hi all. I'm writing a board game for a University project, but i'm in
trouble on the definition of the Board class
i have class Square (which defines every square of the board by some
properties) and now i need a container class Board
class Board{
private:
int length;
vector<Square*> B;
public:
Board(): B(length){};
//~Board();
void setSize(int);
int Begin();
int End();
int moveFW(ints);
};
this is my board.h: setSize let you set the length of the board
(number of squares) and inside the Board() constructor, i define a
vector B of square* (so i can create them dinamically with the square
constructor)
now i need to define the Begin method (returning the first element of
the board), the End method (the last element) and the moveFW method
(in other words, my Board class iterator), but i'm not sure if i can
index directly to my vector B or i need something else
any hint?
thanks!
trouble on the definition of the Board class
i have class Square (which defines every square of the board by some
properties) and now i need a container class Board
class Board{
private:
int length;
vector<Square*> B;
public:
Board(): B(length){};
//~Board();
void setSize(int);
int Begin();
int End();
int moveFW(ints);
};
this is my board.h: setSize let you set the length of the board
(number of squares) and inside the Board() constructor, i define a
vector B of square* (so i can create them dinamically with the square
constructor)
now i need to define the Begin method (returning the first element of
the board), the End method (the last element) and the moveFW method
(in other words, my Board class iterator), but i'm not sure if i can
index directly to my vector B or i need something else
any hint?
thanks!