enum PieceType{BOULDER}
class Piece
{
Piece(int m, PieceType t)// PieceType is an enumeration
{
max = m;
type = t;
}
PieceType getType() const
{
return type;
}
}
class BigPiece : public Piece
{
BigPiece(int m, PieceType t): Pice(m, l){}
}
class smallPiece : public BigPiece
{
smallPiece(char _type) : BigPiece(5, BOULDER)
{
boulderType = _type;
}
}
cha getBoulderType() const
{
return boulderType;
}
class test
{
Piece * l;
l->getBoulderType(); // there error is here.It says that Piece doesnt have a member named getBoulderType
}
There are three that you can use, and they appear as labels: publicprivateprotected
For example:
1 2 3 4 5 6 7 8 9
class BigPiece : public Piece
{
public: // everything below is public, until a new label is found
BigPiece(int m, PieceType t): Pice(m, l){}
private:
int x; // x is private, and so is everything below...
}