I have 2 classes, TournamentMember
and Player
where Player
is derived from TournamentMember
. Each of the classes has parametric constructor.
TournamentMember
has this constructor:
TournamentMember(const char* name, std::string country, int height);
Player
class has this constructor:
Player(int number, int goals, std::string position, std::string feet);
I create an object from the Player
class like this:
Player soccer_player(40, 34, "goalkeeper", "right");
Each soccer player should have 7 properties which are name, country, height, number, goals, position, feet. 4 of those properties are set from Player soccer_player(40, 34, "goalkeeper", "right");
and the left 3 should be assigned from the class TournamentMember. How do I do that? I know a way is from methods (set methods) but I would like to do it with constructors, possibly sth like this: (I know the example below is wrong)
soccer_player.TournamentMember("John", "USA", 170);
Thank you