livestrong
Technical User
Hi Everyone,
Im a newbie to c++ and im trying to inherit a enum from class a to class b
Please see below code exerpt.
Keep getting the below error
Error 1 error C2275: 'Piece::colour' : illegal use of this type as an expression c:\documents and settings\administrator\my documents\visual studio 2005\projects\exercise.cpp 39
Any ideas why?
Thanks
Im a newbie to c++ and im trying to inherit a enum from class a to class b
Please see below code exerpt.
Code:
#include <iostream>
#include <cstring>
using namespace std;
//class piece
class Piece {
int rank; //private
char* row;
public:
//constructor for piece
enum colour {white, black};
Piece(int myrank, char* myrow, Piece::colour)
{
rank = myrank;
row = myrow;
}
};
class Piece1 : public Piece {
public:
Piece1(int myrank, char* myrow, Piece::colour) : Piece(myrank,myrow,Piece::colour)
{
//strcpy(name,myname);
}
};
int main()
{
return 0;
}
Keep getting the below error
Error 1 error C2275: 'Piece::colour' : illegal use of this type as an expression c:\documents and settings\administrator\my documents\visual studio 2005\projects\exercise.cpp 39
Any ideas why?
Thanks