I know what Visitor Pattern is and how to use it; this question is not a duplicate of this one.
I\'ve got a library where I put most of the reusable code I write,
This doesn't look like a case for the Visitor pattern to me.
I would suggest you have a RenderableShape
class that aggregates a Shape
object, then create subclasses for each shape. RenderableShape
would have a virtual render
method.
If you want to support multiple rendering engines, you can have a RenderContext
base class that abstracts drawing operations, with subclasses for each rendering engine, each subclass implementing the drawing operations in terms of its rendering engine. You then have RenderableShape::render
take a RenderContext
as an argument, and draw to it using its abstracted API.