locked
Creational Design pattern RRS feed

  • Question

  • Hi,

    I have a class Animal.

    Class Horse and class Fish inherit from Animal.

    I want to show the user the animals images (Fish and Horse) in a listbox GUI and he shall choose and press OK in order to create Fish or Horse.

    (The images in the listbox shall be dynamic created (for example getting the image from XML).)

    It is not a GUI question :)

    What do you think the preffered design pattern for that ?

    I thought to create class AnimalInfo with Property Image and AnimalTypeEnum. This will be what I am choosing.

    But how do I connect it to the Animal I create afterwards. What does the Animal classt holds ?

    Thanks.

    Saturday, February 2, 2013 9:28 PM