Hi Anthony,
On 2015-11-28 00:16, Anthony Walter wrote:
> type
> IBarkable = interface(IInterface)
> ['{B241068F-2ED9-43C7-066B-778B94CB58F9}']
> procedure Bark;
> end;
> ...snip...
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.
var
intf: IBarkable
begin
if Supports(Animal, IBarbable, intf) then
begin
intf.Bark;
// you can continue here using intf further without casting
end;
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist - [email protected]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal