Class and object types must always be stated in a type section with an explicit type declaration – they cannot be anonymous like record types.
The fundamental reason for this is that you wouldn’t be able to declare the methods of that type because there is no such thing as a type name.
program Produce; var MyClass : class Field: Integer; end; begin end.
It is not permitted to specify a class type within a variable declaration, as shown in the example.
program Solve; type TMyClass = class Field: Integer; end; var MyClass : TMyClass; begin end.
The solution is to give the class type a type declaration. You may have changed the class type to a record type instead.