[fpc-pascal] Implementing Factory Method with Pascal

patspiper patspiper at gmail.com
Sun Nov 29 06:57:25 CET 2015


On 27/11/15 23:21, luciano de souza wrote:
> ...
>
> But, if this not works, how to implement the Factory Method in Freepascal?
What about:

var
   animal: TDog;
BEGIN
   animal := TAnimalFactory.create(atDog);
   try
     if animal is TDog then
       TDog(animal).bark;
   finally
     animal.free;
   end;
END.

Stephano



More information about the fpc-pascal mailing list