My getter and setter functions for Tic Tac Toe are not working <p>Hello I am learning C++ and I need help with my programming code. I am trying to make my private char variable accessible by the local functions inside the class so that I may display it inside Int main(). Everytime I run the compiler it gives me the error ("invalid types 'char[int]'for array subscripts").Also if any one knows how to pass variables inside a class so that I may be able to have the board display the user move;That would be greatly appreciated. P.S I know that done = 0. that was just for me to test the board output.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; class CheckerBoard{ public: void initBoard() { for(int y=0; y&lt;3; y++) { for(int x=0; x&lt;6; x++) { if((x%2)==0) { _board[y][x]='-'; } else { _board[y][x]= '|'; }} } } void printBoard(){ for(int y=0; y&lt;3; y++) { for(int x=0; x&lt;6; x++) { cout&lt;&lt; _board[y][x]; } cout&lt;&lt;endl; } } void setBoard(char board){ _board[3][6]=board;} char getBoard(){ return _board[3][6]; } private: char _board[3][6]; }; int main() {int done=1; int x; int y; while(done==0){ char player1Symbol; char player2Symbol; string player1Name; string player2Name; cout &lt;&lt; "Welcome to Tic Tac Toe Lite" &lt;&lt; endl; cout&lt;&lt;"What is your Name player one?"&lt;&lt;endl; cin&gt;&gt;player1Name; cout&lt;&lt;"What symbol would you like?"&lt;&lt;endl; cin&gt;&gt;player1Symbol; cout&lt;&lt;"What is your name player two?"&lt;&lt;endl; cin&gt;&gt;player2Name; cout&lt;&lt;"What symbol would you like?"&lt;&lt;endl; cin&gt;&gt;player2Symbol; cout&lt;&lt;"Ok player one pick an X coordinate"; cin&gt;&gt;x; cout&lt;&lt;"Now pick an Y coordinate"; cin&gt;&gt;y; if(x&gt;0&amp;&amp;y&gt;0){ board[y][x]=player1Symbol; } CheckerBoard checkerBoard; checkerBoard.initBoard(); checkerBoard.printBoard(); } } CheckerBoard checkerBoard; checkerBoard.initBoard(); checkerBoard.printBoard(); return 0; } </code></pre>