On 25.09.2014 20:13, Chriss Kalogeropoulos wrote:
Hi again,

How would you handle the case of a user adding an interface on a class
marked as reference counted (like a tstringlist descendant,
TArcStringList) and then inherits from that and implements the IUnknown
TFooStringlist =class (TArcStringlist, IInterface).

When one adds an interface to a class that doesn't yet support interfaces then you need to implement the IUnknown methods which you can reroute to the refcount methods of TObject then (TObject will have non virtual methods for manual reference counting that are active if the instance is a reference counted one). If a parent class already introduced interfaces (e.g. TComponent) then it's upon the implementor to decide whether he/she wants to route the interface reference counting to the ARC one or just keep it disabled like TComponent does.

Will he be able to hook on the addref and release methods of the arc
object ? Or at the least use the refcount variable? Will it be done
automatically by the compiler (by using the same method names maybe) ?

The compiler won't do anything automatic here precisely for the reason that then one needs a way to prevent this automatisms.

Regards,
Sven
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to