C++ beginner question regarding chars
<p>I'm just messing around with some C++ at the moment trying to make a simple tic-tac-toe game and I'm running into a bit of a problem. This is my code:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class Square {
public:
    char getState() const;
    void setState(char);
    Square();
    ~Square();
private:
    char * pState;
};

class Board {
public:
    Board();
    ~Board();
    void printBoard() const;
    Square getSquare(short x, short y) const;
private:
    Square board[3][3];
};

int main() {
    Board board;
    board.getSquare(1,2).setState('1');
    board.printBoard();
    return 0;
}

Square::Square() {
    pState = new char;
    *pState = ' ';
}
Square::~Square() {
    delete pState;
}
char Square::getState() const {
    return *pState;
}
void Square::setState(char set) {
    *pState = set;
}

Board::~Board() {

}
Board::Board() {

}
void Board::printBoard() const {
    for (int x = 0; x &lt; 3; x++) {
        cout &lt;&lt; "|";
        for (int y = 0; y &lt; 3; y++) {
            cout &lt;&lt; board[x][y].getState();
        }
        cout &lt;&lt; "|" &lt;&lt; endl;
    }
}
Square Board::getSquare(short x, short y) const {
    return board[x][y];
}
</code></pre>

<p>Forgive me if there are blatantly obvious problems with it or it's stupidly written, this is my first program in C++ :p However, the problem is that when I try and set the square 1,2 to the char '1', it doesn't print out as a 1, it prints out as some strange character I didn't recognise. </p>

<p>Can anyone tell me why? :)</p>

<p>Thanks in advance.</p>
