Click here to Skip to main content
15,616,869 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
using the player, Junior Player and Senior Player class declarations below attempt the question
C++
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();
}


What I have tried:

a. Make function GivePoint() a pure virtual function in class Player. Only rewrite Player class declaration for this.
b. Once the Player class is abstract what single change you must do in JuniorPlayer class to make it non abstract. Only rewrite JuniorPlayer class declaration.

c. 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.

d. Replace the incrementBonus() function in JuniorPlayer class with overloaded form of increment operator prefix form. Remember to set bonusAmount to 0 in the parameter less constructor.
Posted
Updated 15-Apr-21 23:37pm
v2
Comments
Patrice T 16-Apr-21 0:40am    
This is a repost of How do I write a code on[^]

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
You need some deeper insight in the concepts of C++, so visit C++ tutorial Chapter 17 to learn the needed knowledge. You must also read and understand the next chapter for virtual function.

Take the time to understand the theory of all. It is a good tutorial, so spending the time is well invested to solve your task.

PS: Depending on your knowledge you should read it completly. ;-)
 
Share this answer
 
Get together with your classmate Harriet, who has the same problem: How do I write a code on[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900