Solution:
#include <iostream>
using namespace std;
class Franchise{
string name;
string city;
public:
Franchise(){
name= "";
city="";
}
void setname(string n){
name= n;
}
void setcity(string c){
city=c;
}
string getfname(){
return name;
}
string getfcity(){
return city;
}
};
class League{
private:
string name;
string year;
string country;
Franchise franchiseObject;
public:
League(string fname,string fcity,string n,string y,string c){
franchiseObject.setname(fname);
franchiseObject.setcity(fcity);
name=n;
year=y;
country=c;
}
void displayInfo(){
cout << "League name : " << name<<endl;
cout << "League year : " << year<<endl;
cout << "League country : " << country<<endl;
cout << "Franchise name : " << franchiseObject.getfname()<<endl;
cout << "Franchise city : " << franchiseObject.getfcity()<<endl;
}
};
int main()
{
League lg("Islamabad United","Islamabad","PSL","2020","PAKISTAN");
lg.displayInfo();
return 0;
}