Dispatch Table
The Dispatch table is a template class. The map contains a objects that are derived from a base action class. The derived class overrides a pure virtual method called Execute on the base action class. Each derived class is actually templated to hold a function pointer. Execute is always called on the base class and the arguments are always passed as the base type pointers. So as long as Rect and Circle derive from Shape, you can properly call RectToCircle(Rect *, Circle *) through the table by passing (Shape *, Shape *).
This is a pure technical note for myself!
No comments:
Post a Comment