Home  /  Questions  /  Question



85   96.4
Dec 10, 2010


GoF Design Patterns 4.0 pdf question #1

Page 7 states

"Continents are represented as enumerations. The AnimalWorld constructor dynamically creates the desired factory using the Continent enumerated value. "

This is not correct, at least with the code I just downloaded last night.  Continents are not dynamically created using an enumerated value.  AnimalWorld is a generic which takes the continent type as a parameter.

Is the PDF out of synch with the code?

Thanks



810   99.9
Dec 12, 2010
Mike:

You are right. In Design Pattern Framework 4 the AnimalWorld is a generic that takes continent type as parameter, like so:

var africa = new AnimalWorld<Africa>();
africa.RunFoodChain();

We will make the necessary correction to the pdf.

Dan