Advertisement
Mihnea03

sadsa

Mar 7th, 2021
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. class Articol
  5. {
  6. protected:
  7.  
  8.     int cota;
  9.     char *titlul;
  10.  
  11. public:
  12.     Articol()
  13.     {
  14.         cota=0;
  15.         titlul[0]=0;
  16.     }
  17.     Articol(int cota, char *titlul)
  18.     {
  19.         this->cota=cota;
  20.         this->titlul=titlul;
  21.     }
  22.     Articol(Articol &art)
  23.     {
  24.         *this=art;
  25.     }
  26.     int getCota()
  27.     {
  28.         return cota;
  29.     }
  30.     void setCota(int cota)
  31.     {
  32.         this->cota=cota;
  33.     }
  34.     char *getTitlul()
  35.     {
  36.         return titlul;
  37.     }
  38.     void setTitlul(char *title)
  39.     {
  40.         strcpy(titlul, title);
  41.     }
  42.     friend ostream& operator<<(ostream&,Articol&);
  43.     void read();
  44.  
  45. };
  46. class Revista : public Articol
  47. {
  48.  
  49.     int nr;//Numarul revistei
  50.     int tiraj;
  51.     int frecv;// Numarul de aparitii pe luna
  52.  
  53. public:
  54.  
  55.     Revista(int nr,int tiraj,int frecv) : Articol(cota, titlul)
  56.     {
  57.         this->nr=nr;
  58.         this->tiraj=tiraj;
  59.         this->frecv=frecv;
  60.     }
  61.     Revista(Revista &rev)
  62.     {
  63.         *this=rev;
  64.     }
  65.     void display();
  66.     void read();
  67.  
  68. };
  69. class Carte : public Articol
  70. {
  71.     char *autor;
  72.     char *editura;
  73.     int an;//anul aparitiei
  74.  
  75. public:
  76.  
  77.     Carte(char *autor,char *editura, int an) : Articol(cota, titlul)
  78.     {
  79.         this->autor=autor;
  80.         this->editura=editura;
  81.         this->an=an;
  82.     }
  83.     Carte(Carte &car)
  84.     {
  85.         *this=car;
  86.     }
  87.     void display();
  88.     void read();
  89.  
  90. };
  91. int main()
  92. {
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement