April 2017
Beginner to intermediate
394 pages
9h 16m
English
Here, the concept of a prototype doesn't need to be used with virtual functions. We may have a group of objects, for example, easy, hard, and insane enemies that we want to copy. These objects may be the exact same class type, but they could have very different values for health, speed, and damage. In this case, we have our prototypical example that we want to copy from. Of course, in this case we could also just use a copy constructor, but it is possible, as in the case of the Mach5 Engine, that the copy constructor doesn't exist.
Either way, since we don't need to create derived builder classes, we can add prototypes at runtime. Take the above example of the easy, hard, and insane enemy types. We could have ...
Read now
Unlock full access