Delphi Error – E2075 This form of method call only allowed in methods of derived types

Delphi Compiler Error

E2075 This form of method call only allowed in methods of derived types

Reason for the Error & Solution

This error message is issued if you try to make a call to a method of an ancestor type, but you are in fact not in a method.

program Produce;

type
  TMyClass = class
    constructor Create;
  end;

procedure Create;
begin
  inherited Create;      (*<-- Error message here*)
end;

begin
end.

The example tries to call an inherited constructor in procedure Create, which is not a method.

program Solve;

type
  TMyClass = class
    constructor Create;
  end;

constructor TMyclass.Create;
begin
  inherited Create;
end;

begin
end.

The solution is to make sure you are in fact in a method when using this form of call.

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...