Instanciation of an attribute object in another class' constructor

Hi guys,

I'm trying to code a game with a player and its ennemy on a small LED matrix, and I having the following case.

I have a class "Character", from which two class "Player" and "Ennemy" inherit. The class "Character" has a line position and a column position (byte), methods to move around on a LED grid, and a constructor requiring an initial position. The Player and Ennemy class constructors also require initial positions, and pass them to the character constructor, as follows (in ennemy.h here for instance):

Ennemy(byte lineCoordinateInit, byte columnCoordinateInit) : Character(lineCoordinateInit, columnCoordinateInit) {};

I also have a "Game" class, that will manage the game as a whole and its parameters. It has a Player and an Ennemy as private attributes. I currently plan to initiate these two guys in the game constructors, with their initial construction. But that doesn't seem to work... I've notably tried the following (one at a time of course), and none of it works.

Game() {
    Player player(2,2);
    Ennemy ennemy = new ennemy(2,2);
    Ennemy ennemy = new ennemy{2,2};

I've tried changing the "Player" class constructor to pass (2,2) to the character constructor as raw numbers. When doing this, I can instanciate the "player" in my game with simply

Player player;

so it seems it's a question of how I set the constructor arguments...

I've looked for hours, I can't find any answer or correct syntax. Would you guys have any clue ? Let me know if I can bring any other information to this thread, or if something is unclear in my explanations above, of course :slight_smile:

(my game is instanciated in my Main, in my "setup()")

Edit 1: I currently have no Ennemy constructor requiring no parameter, only the one requiring the two bytes. The compilators tells me "error: no matching function for call to 'Ennemy::Ennemy()'", maybe that's the issue?

Edit 2: I've added the Ennemy::Ennemy() constructor, and with the syntax "Ennemy ennemy(2,2);" the stuff compiles. So I guess I needed an "empty" constructor to make the one with arguments work... But when testing, it's the empty constructor that seem to have been called. Would you know why?

Edit 3: I've somehow got a flashback from my 1st university year when I learned all this, 10 years ago, and called the constructors as follows, and it now works :smiley:

Game() : player(1,1), ennemy(2,2){