[fpc-devel] interfaces vs classes in dll
Vincent Snijders
vsnijders at quicknet.nl
Fri Nov 30 11:53:26 CET 2007
Marc Weustink schreef:
> Vincent Snijders wrote:
>> Michael Van Canneyt schreef:
>>>
>>> I find classes more natural than interfaces. It 'just works'. Not so
>>> with interfaces, because you must do a typecast every time.
>>>
>>> Compare
>>>
>>> Function GetPluginInterface : ISOmeThing;
>>>
>>> begin
>>> X:=MyPluginObjectXYZ.Create;
>>> Result:=X as ISomething;
>>> end;
>>>
>> This is then a weakness in the language. Because MyPluginObjectXYZ
>> implements ISOmeThing and the compiler nows that, you should be able
>> to write just
>>
>> Result := MyPluginObjectXYZ.Create;
>
> Weakness ? I do this all the time in Delphi. No need for as
>
I took Michael's example as a requirement, not an option for extra typing :-)
Vincent
More information about the fpc-devel
mailing list