shape.hh 478 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef SHAPE_H
  2. #define SHAPE_h
  3. #include "color.hh"
  4. #include <iostream>
  5. class Shape{
  6. public:
  7. virtual void draw() = 0;
  8. };
  9. class Circle: public Shape{
  10. Color& color;
  11. public:
  12. Circle(Color& color): color(color){};
  13. void draw() override{
  14. std::cout << "Circle\n";
  15. color.paint();
  16. };
  17. };
  18. class Square: public Shape{
  19. Color& color;
  20. public:
  21. Square(Color& color): color(color){};
  22. void draw() override{
  23. std::cout << "Square\n";
  24. color.paint();
  25. };
  26. };
  27. #endif