[fpc-pascal] Implementing Factory Method with Pascal
mailinglists at geldenhuys.co.uk
Sat Nov 28 10:09:38 CET 2015
On 2015-11-28 00:16, Anthony Walter wrote:
> IBarkable = interface(IInterface)
> procedure Bark;
That is a much better solution for what Luciano wants to accomplish.
> and later ...
> if Animal is IBarkable then (Animal as IBarkable).Bark;
This is not good usage of Interfaces. Use the interface variable instead.
if Supports(Animal, IBarbable, intf) then
// you can continue here using intf further without casting
- Graeme -
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal