Compare commits

..

6 commits

Author SHA1 Message Date
Bruno BELANYI 30ffd90b2a fixup! WIP: posts: add mutiple-dispatch-in-c++
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-02 15:54:37 +01:00
Bruno BELANYI 70f99f21fa fixup! WIP: posts: add mutiple-dispatch-in-c++ 2022-11-02 15:52:38 +01:00
Bruno BELANYI cb9545769d fixup! WIP: posts: add mutiple-dispatch-in-c++ 2022-11-02 15:52:38 +01:00
Bruno BELANYI ab2fd4bb69 fixup! WIP: posts: add mutiple-dispatch-in-c++ 2022-11-02 15:52:38 +01:00
Bruno BELANYI 80ef143ef2 fixup! WIP: posts: add mutiple-dispatch-in-c++ 2022-11-02 15:52:38 +01:00
Bruno BELANYI 1f65d803a7 WIP: posts: add mutiple-dispatch-in-c++
All checks were successful
continuous-integration/drone/push Build is passing
2022-06-20 14:49:56 +02:00

View file

@ -189,16 +189,6 @@ e.g: compilers, where the AST class hierarchy represents the data *only*, and
all compiler stages and optimization passes are programmed by a series of
visitors.
One downside of this approach is that if you want to add `SpaceStation` as
a sub-class of `SpaceObject`, and handle its collisions with other
`SpaceObject`s, you need to:
* Implement all `collide_with` methods for this new class.
* Add a new virtual method `collide_with(SpaceStation&)` and implement it on
every sub-class.
This can be inconvenient if your class hierarchy changes often.
## Multiple dispatch on a closed class hierarchy
When even double dispatch is not enough, there is a way to do multiple dispatch