Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. // Флешка
  7. class FlashCard
  8. {
  9.  
  10. public:
  11.  
  12. // Конструкторы
  13.  
  14. // Конструктор с именем и объемом
  15.  
  16. FlashCard(int volume, string name): _volume(volume), _name(name) {}
  17.  
  18. //Конструктор без имени
  19. FlashCard(int volume) : _volume(volume) {
  20. _name = "Default drive";
  21. }
  22. ~FlashCard(){}
  23.  
  24. // Свойства
  25.  
  26. // Объем
  27. int Volume() {
  28. return _volume;
  29. }
  30. // Имя
  31. string GetName() {
  32. return _name;
  33. }
  34. // Задать имя
  35. void SetName(string name) {
  36. _name = name;
  37. }
  38.  
  39. void info() {
  40. cout << "Объём: " << _volume << "\n" << "Имя: " + _name + "\n" << endl;
  41. }
  42.  
  43. private:
  44. // Объем
  45. int _volume;
  46. // Имя
  47. string _name;
  48. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement