vendredi 24 septembre 2021

I cannot get operator+ function to work, have I maybe made a mistake with one of the constructors?

This operator will receive a string with the format "x,y." x represents an x coordinate and y represents a y coordinate. If the coordinates are valid (that is within the valid range of the chess board) then the appropriate variables should be set with these variables. If the coordinates are invalid, then nothing should happen. Constructors: Piece::Piece(Piece *newPiece){ *newPiece = new Piece; }

Piece::Piece(string pType, char side, int x, int y){
string pT = pType;
char s = side;
}
Piece& operator+(string move)


Piece& Piece::operator+(string move){
if(xPos <= side && yPos <= side)
        move = xPos "," yPos;
}

Aucun commentaire:

Enregistrer un commentaire