shushus

Спринт 4. Параметризованный конструктор. Задание 1.

Dec 9th, 2022
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <string>
  2.  
  3. using namespace std;
  4.  
  5. enum class AnimalType {
  6.     Cat,
  7.     Dog,
  8.     Mouse,
  9. };
  10.  
  11. class Animal {
  12. public:
  13.    
  14.     Animal(AnimalType type, string name, string owner_name) {
  15.         type_ = type;
  16.         name_ = name;
  17.         owner_name_ = owner_name;
  18.     }
  19.    
  20.     AnimalType GetType() const {
  21.         return type_;
  22.     }
  23.  
  24.     const string& GetName() const {
  25.         return name_;
  26.     }
  27.  
  28.     const string& GetOwnerName() const {
  29.         return owner_name_;
  30.     }
  31.  
  32. private:
  33.     AnimalType type_;
  34.     string name_;
  35.     string owner_name_;
  36. };
Advertisement
Add Comment
Please, Sign In to add comment