[fpc-pascal] Implementing Factory Method with Pascal
luciano de souza
luchyanus at gmail.com
Fri Nov 27 22:44:16 CET 2015
Yes, it works. But in this case, I don't understand the sense of the pattern.
If I need to do "TAnimalFactory.create(atDog) as Tdog", perhaps, it
would be better not to use a factory, doing simply "TDog.create".
I don't understand if I have implemented the pattern wrongly or if
this pattern, becose of the strong typing of the language, does not
make sense in Pascal.
2015-11-27 19:30 GMT-02:00, Mattias Gaertner <nc-gaertnma at netcologne.de>:
> One solution:
> animal: TDog;
> animal := TAnimalFactory.create(atDog) as TDog;
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
Luciano de Souza
More information about the fpc-pascal