4 ms·
You can totally have modularity and lack of coupling with implementation inheritance. That doesn't mean you necessarily will in every problem (especially if you
by mehrdadn 6y ago
You can totally have modularity and lack of coupling with implementation inheritance. That doesn't mean you necessarily will in every problem (especially if you're not paying attention), but in general it's a false dichotomy.
Also, calling a visitor a glorified switch() is technically correct but makes a mockery out of it. You generally wouldn't want to (well, shouldn't want to) implement it as a switch(), though in simpler situations there might not be much difference. It can have implications on extensibility, modularity, etc... which is kind of obvious, otherwise everyone would be doing that and not going through the trouble of making a visitor.