I've been working on my homework project and now I am to declare a class:
And now how am I to initialize the array `pieces'? Initialize it within the class definition is unavailable:Code:#define PIECE_SIZE 5 #define PIECE_NUM 2 #include <vector> class Piece { class InternalPiece { std::vector<bool> Array; public: InternalPiece(const bool a[]) { for (int i = 0; i < PIECE_SIZE * PIECE_SIZE; ++i) Array[i] = a[i]; } bool operator()(const int &x, const int &y) const { return (bool)Array[x * PIECE_SIZE + y]; } }; public: static const InternalPiece pieces[];
And so is to initialize when you have a Piece object, since the class InternalPiece is private:Code:error: expected constructor, destructor, or type conversion before ‘=’ token
Anyone knows how to solve this? Great thanks.Code:error: ‘class Piece::InternalPiece’ is private



LinkBack URL
About LinkBacks



