fixup! WIP: posts: add mutiple-dispatch-in-c++

This commit is contained in:
Bruno BELANYI 2022-11-02 15:52:38 +01:00
parent cb9545769d
commit 70f99f21fa

View file

@ -107,11 +107,11 @@ and can be used for testing, etc...
## Double dispatch through the Visitor pattern ## Double dispatch through the Visitor pattern
Sometimes single dispatch is not enough, such as in the collision example at Sometimes single dispatch is not enough, such as in the collision example at the
the beginning of this article. In cases where a computation depends on the beginning of this article. In cases where a computation depends on the dynamic
dynamic type of *two* of its values, we can make use of double-dispatch by type of *two* of its values, we can make use of double-dispatch by leveraging
calling a virtual method on the first value, which will call a virtual method the Visitor design pattern. This is done by calling a virtual method on the
on the second value. first value, which itself will call a virtual method on the second value.
Here's a commentated example: Here's a commentated example: