Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #include<iostream>
  2. #include<conio.h>
  3. #include<stdio.h>
  4.  
  5. using namespace std;
  6.  
  7. class telefon {
  8. protected:
  9. int nr;
  10. char NumeOperatori[100];
  11. public:
  12. telefon();
  13. telefon(int nr ,char nume[]);
  14. ~telefon();
  15. telefon(telefon& v);
  16. int getNr();
  17. char getNume();
  18. void setNr(int nr);
  19. void setNume(char nume[]);
  20. void citire();
  21. void virtual afisare();
  22. };
  23.  
  24. telefon::telefon(int nr, char nume[]) {
  25. this->nr = nr;
  26. strcpy(this->NumeOperatori, nume);
  27. }
  28.  
  29. telefon::~telefon() {
  30. cout << "S-a apelat destructorul";
  31. }
  32.  
  33. telefon::telefon(telefon& v) {
  34. this->nr = v.nr;
  35. strcpy(this->NumeOperatori, v.NumeOperatori);
  36. }
  37.  
  38. int telefon::getNr() {
  39. return this->nr;
  40. }
  41.  
  42. char telefon::getNume() {
  43. //return this->NumeOperatori;
  44. }
  45.  
  46. void telefon::setNr(int nr) {
  47. this->nr = nr;
  48. }
  49.  
  50. void telefon::setNume(char nume[] ) {
  51. //NumeOperatori = nume;
  52. }
  53.  
  54. void telefon::citire() {
  55. cout << "Numar = ";
  56. cin >> this->nr;
  57. int maximNume = 5;
  58.  
  59. for (int i = 0;i < maximNume ;i++) {
  60. cout << "Nume = ";
  61. cin >> this->NumeOperatori;
  62. }
  63. }
  64.  
  65.  
  66. class telefonMobil : virtual public telefon {
  67. protected:
  68. int autonomie;
  69. public:
  70. telefonMobil(int autonomie, int nr, int nume[]):telefon(nr,NumeOperatori) {
  71. this->autonomie = autonomie;
  72. }
  73. ~telefonMobil();
  74. telefonMobil(telefonMobil& n);
  75. int getautonomie();
  76. int setautonomie();
  77. void citire();
  78. void virtual afisare();
  79.  
  80. };
  81.  
  82. void main() {
  83. telefon nokia();
  84.  
  85.  
  86.  
  87. _getch();
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement