Answer the question
In order to leave comments, you need to log in
Why do you need a visitor, if you can without him?
Actually, why do you need the opportunity to do client.accept(visitor)
when you can do it visitor.visit(client)
?
Answer the question
In order to leave comments, you need to log in
Because in strongly typed languages, you would first have to cast to a specific type in order to call the visitor's method. Actually, for the sake of solving this problem, the template was invented. This is also known as "double dispatching".
Can you be more specific?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question