Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class tel
- {
- protected:
- int diag;
- string casti;
- public:
- tel(int, string);
- ~tel();
- tel();
- void afisare();
- int set_diag(int a);
- };
- tel::tel()
- {
- diag=0;
- casti=" ";
- }
- tel::~tel()
- {
- cout<<"Distruge obiect"<<endl<<endl;
- }
- tel::tel(int a, string b)
- {
- diag=a;
- casti=b;
- }
- void tel::afisare()
- {
- cout<<diag<<endl<<casti<<endl<<endl;
- }
- int tel::set_diag( int a)
- {
- diag=a;
- }
- class pc
- {
- protected:
- int ram;
- string procesor;
- public:
- pc(int, string);
- ~pc();
- pc();
- void afisare();
- void get_ram();
- };
- pc::pc()
- {
- ram=0;
- procesor=" ";
- }
- pc::~pc()
- {
- cout<<"Obiectul a fost distrus"<<endl<<endl;
- }
- pc::pc( int a, string b)
- {
- ram=a;
- procesor=b;
- }
- void pc::afisare()
- {
- cout<<ram<<endl<<procesor<<endl<<endl;
- }
- void pc::get_ram()
- {
- cout<<ram<<endl<<endl;
- }
- class SmartTEL: public tel, public pc
- {
- private:
- string so;
- int camera;
- public:
- SmartTEL( int, string, int, string, string, int);
- ~SmartTEL();
- void afisare();
- void set_casti( string b);
- friend istream& operator>>(istream&, SmartTEL&);
- };
- SmartTEL::SmartTEL( int a, string b, int c, string d, string e, int f): tel(a, b), pc(c, d)
- {
- so=e;
- camera=f;
- cout<<"Constructor SmartTEL"<<endl<<endl;
- }
- SmartTEL::~SmartTEL()
- {
- cout<<"S-a distrus obiectul"<<endl<<endl;
- }
- void SmartTEL::afisare()
- {
- tel::afisare();
- pc::afisare();
- cout<<so<<endl<<camera<<endl<<endl;
- }
- void SmartTEL::set_casti( string t)
- {
- casti=t;
- }
- istream& operator>>(istream&in, SmartTEL&s)
- {
- in>>s.diag>>s.casti>>s.ram>>s.procesor>>s.so>>s.camera;
- return in;
- }
- int main()
- {
- tel t1(3, "da");
- pc p1( 4, "Dual 1.2");
- SmartTEL s1(5, "da", 2, "Octa 1.2", "Android 6.0", 16);
- t1.afisare();
- p1.afisare();
- s1.afisare();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement