Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- painter.h
- #pragma once
- #include "wall.h"
- class Painter {
- public:
- void Paint(Wall& wall, Wall::Color color_) {
- wall.SetColor(color_);
- }
- };
- ***************************************************************************************************************************************
- wall.h
- #pragma once
- class Wall {
- public:
- enum class Color { BLUE, GREEN, RED, WHITE, YELLOW };
- Wall(double width, double height)
- : width_(width)
- , height_(height)
- , color_(Color::WHITE) {
- }
- double GetHeight() const {
- return height_;
- }
- double GetWidth() const {
- return width_;
- }
- void SetColor(Color color) {
- color_ = color;
- }
- Color GetColor() const {
- return color_;
- }
- private:
- double width_;
- double height_;
- Color color_;
- };
- ***************************************************************************************************************************************
- main.cpp
- #include "painter.h"
- int main() {
- Painter bill;
- Wall wall(3.5, 2.45);
- bill.Paint(wall, Wall::Color::BLUE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement