Perform the following steps to try the code for the factory pattern:
- From a new Terminal, run the following to download the source code:
> cd ~/
> git clone https://github.com/PacktPublishing/Advanced-CPP-CookBook.git
> cd Advanced-CPP-CookBook/chapter11
- To compile the source code, run the following:
> cmake .
> make recipe01_examples
- Once the source code is compiled, you can execute each example in this recipe by running the following commands:
> ./recipe01_example01
> ./recipe01_example02
> ./recipe01_example03
correct answer: The answer is: 42
> ./recipe01_example04
wrong answer: Not sure
> ./recipe01_example05
correct answer: The answer is: 42
In the next section, we will go through each of these examples and explain what each example program does and how it relates to the lessons being taught in this recipe.