Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- class Articol
- {
- protected:
- int cota;
- char *titlul;
- public:
- Articol()
- {
- cota=0;
- titlul[0]=0;
- }
- Articol(int cota, char *titlul)
- {
- this->cota=cota;
- this->titlul=titlul;
- }
- Articol(Articol &art)
- {
- *this=art;
- }
- int getCota()
- {
- return cota;
- }
- void setCota(int cota)
- {
- this->cota=cota;
- }
- char *getTitlul()
- {
- return titlul;
- }
- void setTitlul(char *title)
- {
- strcpy(titlul, title);
- }
- friend ostream& operator<<(ostream&,Articol&);
- void read();
- };
- class Revista : public Articol
- {
- int nr;//Numarul revistei
- int tiraj;
- int frecv;// Numarul de aparitii pe luna
- public:
- Revista(int nr,int tiraj,int frecv) : Articol(cota, titlul)
- {
- this->nr=nr;
- this->tiraj=tiraj;
- this->frecv=frecv;
- }
- Revista(Revista &rev)
- {
- *this=rev;
- }
- void display();
- void read();
- };
- class Carte : public Articol
- {
- char *autor;
- char *editura;
- int an;//anul aparitiei
- public:
- Carte(char *autor,char *editura, int an) : Articol(cota, titlul)
- {
- this->autor=autor;
- this->editura=editura;
- this->an=an;
- }
- Carte(Carte &car)
- {
- *this=car;
- }
- void display();
- void read();
- };
- int main()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement