[fpc-devel]Inherited Interfaces
Ivan Shikhalev
fpc at fromru.com
Mon Mar 18 09:08:52 CET 2002
Hello.
At present, a class can not inherit interfaces implemented by its ancestors.
I think that it is not right. To correct the given fact, it is necessary
only to add a few lines in the unit ObjPas in a method
TObject.GetInterfaceEntry():
class function TObject.getinterfaceentry(const iid : tguid) :
pinterfaceentry;
var
i: integer;
intftable: pinterfacetable;
Res: pinterfaceentry;
begin
getinterfaceentry:=nil;
intftable:=getinterfacetable;
if assigned(intftable) then begin
i:=intftable^.EntryCount;
Res:=@intftable^.Entries[0];
while (i>0) and
not (assigned(Res^.iid) and IsGUIDEqual(Res^.iid^,iid)) do
begin
inc(Res);
dec(i);
end;
if (i>0) then
getinterfaceentry:=Res
{ begin of correction block 1 }
else if ClassParent <> nil
then getinterfaceentry :=
ClassParent.GetInterfaceEntry (IID)
{ end of correction block 1 }
;
end
{ begin of correction block 2 }
else if ClassParent <> nil
then getinterfaceentry :=
ClassParent.GetInterfaceEntry (IID)
{ end of correction block 2 }
;
end;
----------------
Ivan Shikhalev
http://fpc.by.ru/
http://iws.by.ru/
More information about the fpc-devel
mailing list