An indexed property of the class is referred to, but no default property is available in the class.
One of the indexed properties of the class should be declared using the Default directive, or identifier of the property that is referred to should be explicitly specified. Using various directives is described in the Descriptions and Rules of Syntax: Classes Description section.
Class TestClass: Object
Temp: Array Of Integer;
Public Property Item(i: Integer): Integer
Get
Begin
Return Temp[i];
End Get
Set
Begin
Temp[i] := Value;
End Set
End Property Item;
End Class TestClass;
Sub Main;
Var
Obj: TestClass;
i: Integer;
Begin
Obj := New TestClass.Create;
i := Obj(1);
End Sub Main;
When the specified code is compiled, the string i := Obj(1); displays the following error: Object of the <ClassIdentifier> class has no default property. To resolve the error, execute one of the operations:
Specify explicitly the identifier of the property Item - i := Obj.Item(1).
Specify the Default directive in the description of the Item property of the class TestClass- End Property Item; Default.
See also: