<div dir="ltr">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? Is there some technical limitation on why this is only done with interfaces and not all objects that descend from a refcounted interface?<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 21, 2013 at 2:38 PM, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com" target="_blank">pascaldragon@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Am <a href="tel:21.03.2013%2014" value="+12103201314" target="_blank">21.03.2013 14</a>:23, schrieb Kostas Michalopoulos:<div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes, that is what i mean with "topmost" type: if you look at the inheritance as a tree, TInterfacedObject is the topmost (or root, if you think of it as an upside-down tree) of the type hierarchy. In this code<br>
<br>
type<br>
IBlah = interface ... end;<br>
TBlah = class(TInterfacedObject, IBlah) ... end;<br>
<br>
TBlah is an IBlah, so i'd expect it to behave like IBlah.<br>
</blockquote>
<br></div>
And it behaves like an IBlah, because you can assign a TBlah to every variable or parameter that expects a IBlah.<br>
The point however is that the compiler only inserts calls to AddRef and Release (which are provided by the base interface IUnknown/IInterface and of which every (COM) interface is derived) if the variable you work with is of an interface type.<div class="HOEnZb">
<div class="h5"><br>
<br>
Regards,<br>
Sven<br>
<br>
--<br>
______________________________<u></u>_________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.<u></u>freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.<u></u>freepascal.org/mailman/<u></u>listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>