How to refer to an object of another class?

Mar 7, 2013 at 9:49pm
I have just started OOP and I'm trying to make a user vs user Chess game. I've made classes for different pieces. I'm stuck at a point on making this pawn class. In it there is a function, which will take several squares as co- ordinates, and tell whether the move by the user is valid or not. It will perform several checks, and one of those checks are "Is there another piece of the same color at the square on which the user has ordered to move?" And I just don't know how to write this thing in C++ syntax -_-
Here's the partially made pawn class:
"class whitePawns:whites{ //whites is a super class that indicates that the piece is white
private:
string code = "pawns";
public:
checkValidMovie(int xi, int yi, int xf, int yf, string board1[8][8]){
if(board[xi + xf] == "
Last edited on Mar 7, 2013 at 10:02pm
Mar 7, 2013 at 9:58pm
In case I'm unclear, the question I'm asking is basically how to check whether an identifier as an object of some particular class? Such as we check if(a == 3) , I want to check something like(if something == an object of whites).
Topic archived. No new replies allowed.