RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2228: A dispinterface type cannot have an ancestor interface (Delphi)

An interface type specified with dispinterface cannot specify an ancestor interface.

program Produce;

  type
    IBase = interface
    end;

    IExtend = dispinterface (IBase)
    ['{00000000-0000-0000-0000-000000000000}']

    end;

begin
end.

In the example above, the error is caused because IExtend attempts to specify an ancestor interface type.

program Solve;

  type
    IBase = interface
    end;

    IExtend = dispinterface
    ['{00000000-0000-0000-0000-000000000000}']

    end;

begin
end.

Generally there are two solutions when this error occurs: remove the ancestor interface declaration, or change the dispinterface into a regular interface type. In the example above, the former approach was taken.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!