mardi 28 novembre 2017

Vector creating which contains type*

Class has a definitions in private area

private:
    vector <int *> moves;
    int counter = 0;

and some function in class

void ConnectFourPlusUndo::backupMoves(int i,int j)
{
    cout << "getcounter" << getCounter() << endl;

    moves[getCounter()] = new int[2];
    /*Error occurs here*/

    int tempArr[2]; 

    setCounter(getCounter()+1);

    tempArr[0] = i;
    tempArr[1] = j;

    moves.push_back(tempArr);

    return;
}   

Guys how can i solve this error? Any idea?

Aucun commentaire:

Enregistrer un commentaire