class Piece
{
private:
e_pieces type; // type of piece (EMPTY if no piece placed)
bool winning; // true if piece was the winning move
bool player; // true = player 1, false = player 2
public:
Piece();
~Piece();
Piece & operator=(const e_pieces &rhs);
e_pieces operator=( const Piece &rhs );
etc.
}; // endof class Piece
but when I try the assignment like: temp=board[0], the compiler complains:
error C2440: 'initializing' : cannot convert from 'demo::Piece' to 'e_pieces'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
It appears that I can do board[0]=<e_pieces> but not the reverse?
When you declare an operator as a member function, the first parameter is Piece and is on the left side. If you want to have it on the right side, declare a global operator + (e_pieces, Piece).