I understand a Visitor pattern to an extend. What I could not gauge is how this pattern can replace an "if Else Condition" ..
I read a topic earlier - but was not clear - Can any one explain me with a simpler terms ..and with an example possibly.
More generally it is acknowledged that you can replace "if" with inheritance (polymorphism). I think [this article|http://sourcemaking.com/refactoring/replace-conditional-with-polymorphism] describes it well, with code examples.
Several well-known patterns leverage this (State, Strategy, Command,... oh, and yes, Visitor too).
P.S.: Please clarify your question. The previous poster replied to the question implied by the title of your post. But the text of your post implies you have a question specific to the Visitor pattern.
Edited by: jduprez on Aug 13, 2010 9:31 PM