HomeDelphiDelphi Error – E2206 Property overrides not allowed in interface type

Delphi Error – E2206 Property overrides not allowed in interface type

Delphi Compiler Error

E2206 Property overrides not allowed in interface type

Reason for the Error & Solution

A property which was declared in a base interface has been overridden in an interface extension.

program Produce;
  type
    Base = interface
      function Reader : Integer;
      function Writer(a : Integer);
      property Value : Integer read Reader write Writer;
    end;

    Extension = interface (Base)
      function Reader2 : Integer;
      property Value Integer read Reader2;
    end;

begin
end.

The error in the example is that Extension attempts to override the Value property.

program Solve;
  type
    Base = interface
      function Reader : Integer;
      function Writer(a : Integer);
      property Value : Integer read Reader write Writer;
    end;

    Extension = interface (Base)
      function Reader2 : Integer;
      property Value2 Integer read Reader2;
    end;

begin
end.

A solution to this error is to rename the offending property. Another, more robust, approach is to determine the original intent and restructure the system design to solve the problem.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...