Table of Contents |
Internal operation: Motion data buffer | Internal operation: Design issues
The code is organised as illustrated in Figure 8. An inheritance tree is used to separate each overlay into distinct classes with the interface defined by the pure virtual functions in the base class. This structure has two advantages; firstly additional overlays may be added with minimal change to written classes (a new overlay would need to be declared in the Overlay class). Secondly, this structure allows for runtime polymorphism where a pointer of type DrawOverlay is declared and can be used to point at any of its sub-classes. The DrawBlock() function is called on the pointer in order for the overlay to be drawn but the decision of which object to instantiate is made at runtime.
Figure 8. Flow of operation and class structure