double dispatch in Visitor design pattern

来源:互联网 发布:怎么防止网络攻击 编辑:程序博客网 时间:2024/04/24 21:29

 

Tow dispatchs take place at the following places:

1. Invoke of Element.accept : overide of accept

2. Inplemention of Element.accept : overload of visit.

the core concept of double dispatch is the accept Method.

 

The first dispatch takes place at run time, which is override just right. accept method needs only one signature.

the second dispatch takes place at compile time, which is overload just right. visit method nees multiple signature.

 

原创粉丝点击