CS304 ASSIGNMENT SOLUTION CODE:
#include<iostream>
#include<string>
using namespace std;
class Franchise{
private:
string name;
string city;
public:
Franchise();
void setName(string);
void setCity(string);
string getName();
string getCity();
};
Franchise::Franchise(){
}
void Franchise::setName(string n){
name = n;
}
void Franchise::setCity(string c){
city = c;
}
string Franchise::getName(){
return name;
}
string Franchise::getCity(){
return city;
}
class league{
private:
string naame;
string country;
int year;
Franchise french;
public:
league(string , int, string , string , string);
void displayInfo();
};
league::league(string n, int y, string c, string name, string city){
naame = n;
country = c;
french.setCity(city);
city = french.getCity();
year = y;
french.setName(name);
name = french.getName();
}
void league::displayInfo(){
cout<<"League Name :"<<naame<<endl;
cout<<"League Year :"<<year<<endl;
cout<<"League County :"<<country<<endl;
cout<<"Franchise name :"<<french.getName()<<endl;
cout<<"Frenchise City :"<<french.getCity()<<endl;
}
main(){
league l("PSL",2020,"Pakistan","Islamabad United","Islamabad");
l.displayInfo();
}
No comments:
Post a Comment