Answer to Question #286417 in C++ for Aleeza

Question #286417

Using the Player, JuniorPlayer class declaration attempt the question. Write constructor that would Call from JuniorPlayer class the Player class Parameterized constructor and also give values to JuniorPlayer class data members and Player class data members.



class Player {


string name;


string playerId;


public:


Player();


Player(string,string);


void Register(string,string);


void Display();


void Givepoint();


};



class JuniorPlayer : public Player{


int bonusamount;


public :


void Display();


JuniorPlayer incrementBonus();


};




1
Expert's answer
2022-01-10T13:51:44-0500
#include <iostream>
using namespace std;




class Player {
private:
	string name;
	string playerId;
public:
	Player();
	Player(string,string);
	void Register(string,string);
	void Display();
	void Givepoint();
};


class JuniorPlayer : public Player{
private:
	int bonusamount;
public :


	JuniorPlayer(int bonusamount,string name,string playerId):Player(name,playerId){
		this->bonusamount=bonusamount;
	}


	void Display();
	JuniorPlayer incrementBonus();
};


int main() {




	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment