Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- using namespace std;
- class Category
- {
- private:
- char ime[20]="unnamed";
- public:
- Category(){}
- Category(char ime[])
- {
- strcpy(this->ime,ime);
- }
- void print()
- {
- cout<<"Category:"<<" "<<ime<<endl;
- }
- };
- class NewsArticle
- {
- private:
- Category c;
- char title[30]="untitled";
- public:
- NewsArticle(){}
- NewsArticle(Category c,char title[])
- {
- this->c=c;
- strcpy(this->title,title);
- }
- NewsArticle(Category c)
- {
- this->c=c;
- }
- void print()
- {
- cout<<"Article title:"<<" "<<title<<endl;
- c.print();
- }
- };
- class FrontPage
- {
- private:
- NewsArticle art;
- float price=0;
- int editionNumber=0;
- public:
- FrontPage(){}
- FrontPage(NewsArticle art,float price,int editionNumber)
- {
- this->art=art;
- this->price=price;
- this->editionNumber=editionNumber;
- }
- FrontPage(NewsArticle art,float price)
- {
- this->art=art;
- this->price=price;
- }
- void print()
- {
- cout<<"Price:"<<" "<<price<<","<<" "<<"Edition number:"<<" "<<editionNumber<<endl;
- art.print();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement