Delphi – E2076 This form of method call only allowed for class methods

You were attempting to call a regular method by simply providing the class type, rather than an actual instance.

Normal methods and destructors are not allowed, only class methods and constructors.

program Produce;

type
  TMyClass = class
  (*...*)
  end;
var
  MyClass: TMyClass;

begin
  MyClass := TMyClass.Create;  (*Fine, constructor*)
  Writeln(TMyClass.ClassName); (*Fine, class method*)
  TMyClass.Destroy;            (*<-- Error message here*)
end.

The example attempts to destroy the type TMyClass, which is illogical and so unlawful.

program Solve;
type
  TMyClass = class
  (*...*)
  end;
var
  MyClass: TMyClass;

begin
  MyClass := TMyClass.Create;  (*Fine, constructor*)
  Writeln(TMyClass.ClassName); (*Fine, class method*)
  MyClass.Destroy;             (*Fine, called on instance*)
end.

As you can see, we intended to destroy the type’s instance rather than the type itself.