#pragma once class Drawable; class RenderTarget { public: void draw(const Drawable& drawable); }; class Drawable { public: /* * NOTE: This requires const because RenderTarget * pass itself in as a *this which is always const. * If you need to draw without const then invert it * then use shape.render_to(target) instead. */ virtual void draw(RenderTarget& target) const = 0; virtual void render_to(RenderTarget& target) = 0; }; class Shape : public Drawable { public: void draw(RenderTarget& target) const override; void render_to(RenderTarget &target) override; };