Class or interface types must always be declared with an explicit type declaration in a type section. Unlike record types, they cannot be anonymous.
The main reason for this is that there would be no way you could declare the methods of that type (since there is no type name).
Incorrect (attempting to declare a class type within a variable declaration):
program Produce; var MyClass : class Field: Integer; end; begin end.
Correct:
program Solve; type TMyClass = class Field: Integer; end; var MyClass : TMyClass; begin end.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|