From 70f99f21fa76db751dd2ff476c966a9e5b7f43c4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 2 Nov 2022 15:52:38 +0100 Subject: [PATCH] fixup! WIP: posts: add mutiple-dispatch-in-c++ --- .../posts/2022-06-07-multiple-dispatch-in-c++/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/posts/2022-06-07-multiple-dispatch-in-c++/index.md b/content/posts/2022-06-07-multiple-dispatch-in-c++/index.md index 902149a..b2377bf 100644 --- a/content/posts/2022-06-07-multiple-dispatch-in-c++/index.md +++ b/content/posts/2022-06-07-multiple-dispatch-in-c++/index.md @@ -107,11 +107,11 @@ and can be used for testing, etc... ## Double dispatch through the Visitor pattern -Sometimes single dispatch is not enough, such as in the collision example at -the beginning of this article. In cases where a computation depends on the -dynamic type of *two* of its values, we can make use of double-dispatch by -calling a virtual method on the first value, which will call a virtual method -on the second value. +Sometimes single dispatch is not enough, such as in the collision example at the +beginning of this article. In cases where a computation depends on the dynamic +type of *two* of its values, we can make use of double-dispatch by leveraging +the Visitor design pattern. This is done by calling a virtual method on the +first value, which itself will call a virtual method on the second value. Here's a commentated example: