Back to Browse

Dynamic Casting vs Visitor Design Pattern (With C++ Example)

1.5K views
Feb 26, 2021
23:39

We might know we have a pointer to a base class object. But how do we determine exactly what derived type it is? What if we have something like a collision event in a video game, and we need to know the exact types for both objects so we can properly react? This video shows two ways to accomplish this task. One involves single dispatch and lots of dynamic_casting. The other involves double dispatch, the visitor-ish design pattern, no dynamic casting at all, but at the price of a more complicated architecture on both the base class and all derived classes. Bradley Sward is currently an Associate Professor at the College of DuPage in suburban Chicago, Illinois. He has earned a Masters degree in Software Engineering from DePaul University, a Masters degree in Computer Science from the University of Illinois at Springfield, and two Bachelors degrees in Computer Science and Molecular Biology from Benedictine University. Prior to teaching, Bradley worked for five years in the field of casino gaming on a variety of video slot machine and poker games. The Village People have been permanently etched into his brain.

Download

0 formats

No download links available.

Dynamic Casting vs Visitor Design Pattern (With C++ Example) | NatokHD