April 2017
Beginner to intermediate
394 pages
9h 16m
English
So far, we have seen simple examples of how the Prototype pattern is implemented. If you thought that the examples were easy, you are in luck--it doesn't get much harder than that. We also discussed a few ways in which an object instance and a virtual constructor can be useful in a game. Now let's look at how the Mach 5 Engine uses the Prototype pattern in the M5Component and M5Object classes. Since the M5Object class uses the M5Component Clone method, let's look at the components first.
In Chapter 3, Improving on the Decorator Pattern with the Component Object Model, we examined almost all the methods and member variables in the M5Component class. However, the method we didn't talk about was the Clone ...
Read now
Unlock full access