-
Book Overview & Buying
-
Table Of Contents
Software Architecture with C++ - Second Edition
By :
In this section, we’ll discuss common solutions to problems related to object creation. However, we’ll take a slightly different approach from the Gang of Four patterns when describing their solutions. They proposed complex, dynamically polymorphic class hierarchies as proper implementations of their patterns. In the C++ world, many patterns can be applied to real-world problems without introducing as many classes and the overhead of dynamic dispatch. That’s why, in our case, the implementations will be different and in many cases simpler or more performant (although more specialized and less “generic” in the Gang of Four sense). Let’s dive right in.
The first type of creational patterns we’ll discuss here is factories. They’re useful when the object construction can be done in a single step, but when the constructor just isn’t good enough on its own. There are three types of factories...