Advertisement
chevengur

СПРИНТ № 5 | Распределение кода по файлам | Урок 4: Заголовочные файлы и файлы с реализацией 1/2

Mar 10th, 2024 (edited)
672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. wall.cpp
  2.  
  3. #include "wall.h"
  4.  
  5. Wall::Wall(double width, double height)
  6.     : width_(width)
  7.     , height_(height)
  8.     , color_(Color::WHITE) {
  9. }
  10. double Wall::GetHeight() const
  11. {
  12.     return height_;
  13. }
  14.  
  15. double Wall::GetWidth() const
  16. {
  17.     return width_;
  18. }
  19.  
  20. void Wall::SetColor(Color color)
  21. {
  22.     color_ = color;
  23. }
  24.  
  25. Wall::Color Wall::GetColor() const
  26. {
  27.     return color_;
  28. }
  29.  
  30. ***************************************************************************************************************************************
  31.  
  32. wall.h
  33.  
  34. class Wall {
  35. public:
  36.     enum class Color { BLUE, GREEN, RED, WHITE, YELLOW };
  37.  
  38.     Wall(double width, double height);
  39.  
  40.     double GetHeight() const;
  41.     double GetWidth() const;
  42.     void SetColor(Color color);
  43.     Color GetColor() const;
  44.  
  45. private:
  46.     double width_;
  47.     double height_;
  48.     Color color_;
  49. };
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement