daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4. class Category
  5. {
  6.     private:
  7.     char ime[20]="unnamed";
  8.     public:
  9.     Category(){}
  10.     Category(char ime[])
  11.     {
  12.         strcpy(this->ime,ime);
  13.     }
  14.     void print()
  15.     {
  16.         cout<<"Category:"<<" "<<ime<<endl;
  17.     }
  18.    
  19. };
  20. class NewsArticle
  21. {
  22.     private:
  23.     Category c;
  24.     char title[30]="untitled";
  25.     public:
  26.     NewsArticle(){}
  27.     NewsArticle(Category c,char title[])
  28.     {
  29.         this->c=c;
  30.         strcpy(this->title,title);
  31.     }
  32.     NewsArticle(Category c)
  33.     {
  34.         this->c=c;
  35.    
  36.     }
  37.     void print()
  38.     {
  39.         cout<<"Article title:"<<" "<<title<<endl;
  40.         c.print();
  41.     }
  42. };
  43. class FrontPage
  44. {
  45.     private:
  46.     NewsArticle art;
  47.     float price=0;
  48.     int editionNumber=0;
  49.     public:
  50.     FrontPage(){}
  51.     FrontPage(NewsArticle art,float price,int editionNumber)
  52.     {
  53.         this->art=art;
  54.         this->price=price;
  55.         this->editionNumber=editionNumber;
  56.     }
  57.     FrontPage(NewsArticle art,float price)
  58.     {
  59.         this->art=art;
  60.         this->price=price;
  61.     }
  62.     void print()
  63.     {
  64.         cout<<"Price:"<<" "<<price<<","<<" "<<"Edition number:"<<" "<<editionNumber<<endl;
  65.         art.print();
  66.     }
  67. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top