[Lazarus] IUnknown and reference counting

Sven Barth pascaldragon at googlemail.com
Thu Mar 21 20:38:37 CET 2013


Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" <DrDiettrich1 at aol.com>:
>
> Kostas Michalopoulos schrieb:
>
>> Thanks, i understand that. My question is, can i somehow make FPC to add
AddRef/Release calls also to TBlah so i can use refcounting with a class
just like i would use it with an interface?
>
>
> When you declare IBlah and implement it in TBlah, you can use:
>
> var MyBlah: IBlah; //instead of TBlah!
> ...
>   MyBlah := TBlah.Create as IBlah;

You don't need the "as".

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130321/8b1395e7/attachment-0003.html>


More information about the Lazarus mailing list