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;
With
Function GetPluginInterface : TSomeClass;
begin
Result:=MyPluginObjectXYZ.Create;
end;
Vincent
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel