mardi 14 juin 2022

How to access field of inheritance child class in constructor of parent class?

I have couple classes, players and game, game inheritances after players, how may I access players fields withing game constructor?

class players {
public:
    int pawns[4][4];
}

class game : public players (...)

game::game(pref inpref,
    int inpawns[4][4]
) : 
{
    this->prefs = inpref;
    players::pawns = inpawns;  // <-DOEST WORK, BUT SHOWS WHAT I MEAN
}

Aucun commentaire:

Enregistrer un commentaire