lastInstance

lastInstance(): InstanceType;

The lastInstance method of the Class class returns a reference to the last instance of the class.

The code fragment in the following example shows the use of the lastInstance method.

if Customer.firstInstance = null then
    instancesTable.text := "0010";
else     // add 10 to last one used; that is, sequentially allocate
         // the next free Customer number
    instancesTable.text := (Customer.lastInstance.customerNumber +
                            10).String.padLeadingZeros(4);
endif;

See also "Caveat When Handling Persistent Class Instances", earlier in this section.