Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- #include<stdio.h>
- using namespace std;
- class telefon {
- protected:
- int nr;
- char NumeOperatori[100];
- public:
- telefon();
- telefon(int nr ,char nume[]);
- ~telefon();
- telefon(telefon& v);
- int getNr();
- char getNume();
- void setNr(int nr);
- void setNume(char nume[]);
- void citire();
- void virtual afisare();
- };
- telefon::telefon(int nr, char nume[]) {
- this->nr = nr;
- strcpy(this->NumeOperatori, nume);
- }
- telefon::~telefon() {
- cout << "S-a apelat destructorul";
- }
- telefon::telefon(telefon& v) {
- this->nr = v.nr;
- strcpy(this->NumeOperatori, v.NumeOperatori);
- }
- int telefon::getNr() {
- return this->nr;
- }
- char telefon::getNume() {
- //return this->NumeOperatori;
- }
- void telefon::setNr(int nr) {
- this->nr = nr;
- }
- void telefon::setNume(char nume[] ) {
- //NumeOperatori = nume;
- }
- void telefon::citire() {
- cout << "Numar = ";
- cin >> this->nr;
- int maximNume = 5;
- for (int i = 0;i < maximNume ;i++) {
- cout << "Nume = ";
- cin >> this->NumeOperatori;
- }
- }
- class telefonMobil : virtual public telefon {
- protected:
- int autonomie;
- public:
- telefonMobil(int autonomie, int nr, int nume[]):telefon(nr,NumeOperatori) {
- this->autonomie = autonomie;
- }
- ~telefonMobil();
- telefonMobil(telefonMobil& n);
- int getautonomie();
- int setautonomie();
- void citire();
- void virtual afisare();
- };
- void main() {
- telefon nokia();
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement