AndyG wants us to stop misusing dynamic_cast
and start using a visitor pattern
Stop reimplementing the virtual table and start using double dispatch
by AndyG
From the article:
In this tutorial, I’ll talk about one solution to this problem I’ve had some success with: the double-dispatch Visitor pattern. With it, you can trim down those long if-else if blocks, separate responsibility into manageable pieces, and even stabilize your interface better.
Add a Comment