Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2002-03

Inherited Interfaces

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ivan Shikhalev

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;
            ;
            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/