Am 22.08.2012 21:45, schrieb Graeme Geldenhuys:
On 22 August 2012 10:19, Sven Barth <pascaldra...@googlemail.com> wrote:
Depending on how they implement it this might indeed be an interesting
feature that we could implement (cherry picking Delphi features ^^).
It's already possible, just use IInterface (and TInterfacedObject)
everywhere. :)
You need to work with variables of type IInterface then so that the
reference counting mechanism works correctly. The compiler does not
generate reference managament code if you work with a variable of type
TInterfacedObject or decendant. E.g.:
var
i: IInterface;
begin
i := TSomeInterfacedObjectDescendant.Create;
(i as TSomeInterfacedObjectDescendant).SomeMethodOfThatClass;
end;
This just looks ugly...
The other possibility is to define an interface for the class you want
to use, but that's duplication I'd like to avoid...
Regards,
Sven
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel