Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include<iostream> #include<iomanip> #include<string> using namespace std; const

ID: 3539139 • Letter: #

Question

#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
const int i = 5;

class player
{
protected:
    string name[10];
    string ID;
public:
    player(){};
    player(string nm[], string id)
    {
        name[10]=nm[10];
        ID=id;
    }
};
class formal : public player
{
   
    int score;
   
public:
    formal(){};
    formal(int scr)
    {
        score=scr;
       
    }
    void getInfoformal()
    {
        for(int a=0;i<i;a++)
        {
            cout<<"enter Name, ID, Score for Player"<<a<<":"<<endl;
            cin>>name[a];
            cin>>ID;
            cin>>score;
        }
    }
    void displayformal()
        {
           
            for(int a=0;i<i;a++)
            {
            cout<<"Name"<<a<<":"<<name<<endl;
            cout<<"ID:"<<ID<<endl;
            cout<<"score:"<<score<<endl;
       
            }
        }
   
};
class backupPlayer: public player
{
   
    int score;
   
   
    public:
        backupPlayer(){};
    backupPlayer(int scr)
    {
        score=scr;   
    }
    void getInfobackup()
    {
        for(int a=0;i<i;a++)
        {
            cout<<"enter Name, ID, Score for Player"<<a<<":"<<endl;
            cin>>name[a];
            cin>>ID;
            cin>>score;
        }
    }
    void displaybackup()
        {
           
            for(int a=0;i<i;a++)
            {
            cout<<"Name"<<a<<":"<<name<<endl;
            cout<<"ID:"<<ID<<endl;
            cout<<"score:"<<score<<endl;
       
            }
        }
};
class team : public player
{
    string name;
public:
    team(){ name = "";}
        team(string n)
    {
        name = n;
    }
        string getteam(string tm)
        {
            return name;
        }
        void displayteam()
        {
            cout<<"team:"<<name;
        }
};
int main()
{
    formal f;
    team t;
    t.getteam("arsenal");
    t.displayteam();

    f.getInfoformal();
    f.displayformal();
    return 0;
}


i need help with this program. i need to use composition and aggregation

Explanation / Answer

you use

backupPlayer(){};

but two brackets like this usually not admisable

try to use only one

backupPlayer{};