#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.draw(target) instead, which is * not const. */ virtual void draw(RenderTarget& target) const = 0; virtual void draw(RenderTarget& target) = 0; }; class Shape : public Drawable { public: void draw(RenderTarget& target) const override; void draw(RenderTarget& target) override; };