Visitor Pattern C++ example is missing accept() method implementations
The C++ Visitor Pattern example declares the accept() methods in the Circle and Rectangle classes, but their implementations are missing.
Currently, both classes only contain:
void accept(ShapeVisitor* visitor) override;This is only a method declaration. It does not automatically call visitCircle() or visitRectangle().
The methods should either be implemented directly inside their respective classes or defined outside the classes after the complete ShapeVisitor definition.
For example:
void Circle::accept(ShapeVisitor* visitor) {
visitor->visitCircle(this);
}
void Rectangle::accept(ShapeVisitor* visitor) {
visitor->visitRectangle(this);
}Without these definitions, the provided code is incomplete and results in linker errors for Circle::accept() and Rectangle::accept().
Please add the missing implementations either directly inside the concrete shape classes or outside them after defining ShapeVisitor.
Source: ashishps1/awesome-low-level-design