I started writting a simple program with classes in C++ to get comfortable with OOP. I wrote a class Game that takes instances of classes Player and Unit as attributes:
#ifndef GAME_HPP
#define GAME_HPP
#include "Unit.hpp"
#include "Player.hpp"
class Game
{
public:
    //ATTRIBUTES
    Player player;
    Unit mob;
    
    //CONSTRUCTORS
    Game(Player, Unit){};
    
    //METHODS
    std::string get_n_chars(char, int);
    void print_player_character_panel();
    void print_enemy_character_panel();
    void print_character_panels();
};
#endif // GAME_HPP
I want the 'mob' attribute to take any inherited class of 'Unit', i.e.
class Goblin : public Unit
{...
int main()
{    
    Player hero{"Boi"};
    Goblin goblin;
    Game game1(hero, goblin);
    
    return 0;
}
But when I do this then 'mob' only has the attributes and methods of a 'Unit'. Like this:
https://i.stack.imgur.com/nShv3.png
And even attributes from the contructor changed:
https://i.stack.imgur.com/mPrW2.png
Can I somehow declare an instance of any inherited class of 'Unit' as mob attribute and for it to remain an instance of that class instead of 'Unit.'
 
    