Double dispatch is a way to call different (but-related) concrete functions depending on the runtime types of the various objects involved in the call. IT basically replacing static compile time casting with dynamic resolving of calls.
Here is an example of the a double dispatch. Let's say it's a game. You have a wildanimal that attacks types of humans, and a warrior which derives from human. Let us consider a wildanimal attacking a warrior. I strongly suggest running this code for a better understanding.
The problem is on line 60 you have
w->attack(h). This leads to static compile time function overloading and you end up selecting the 'Human Attack' at line 44. This leads to a wild animal attacking a human despite the fact that it should be attacking a warrior.
The solution is to have a DD that allows the proper dynamic cast by using the 'this' pointer (line 26). Now when you call
h->attackedbywildanimal(w); at line 54 you will get the correct wild animal attacking a warrior instead of a human.
Note that a simpler but far less flexible solution would have been to simply statically cast the pointer at line 50 to be
w->attack((warrior*)h);.
Note that to have all the code in a single file I needed class definitions at the top and the wildanimal implementation is actuall at the bottom. Remind me to use java next time!