Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- using namespace std;
- // Флешка
- class FlashCard
- {
- public:
- // Конструкторы
- // Конструктор с именем и объемом
- FlashCard(int volume, string name): _volume(volume), _name(name) {}
- //Конструктор без имени
- FlashCard(int volume) : _volume(volume) {
- _name = "Default drive";
- }
- ~FlashCard(){}
- // Свойства
- // Объем
- int Volume() {
- return _volume;
- }
- // Имя
- string GetName() {
- return _name;
- }
- // Задать имя
- void SetName(string name) {
- _name = name;
- }
- void info() {
- cout << "Объём: " << _volume << "\n" << "Имя: " + _name + "\n" << endl;
- }
- private:
- // Объем
- int _volume;
- // Имя
- string _name;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement