New (procedure)

Creates a new dynamic variable and sets a pointer variable to point to it.

Declaration

procedure New(var P: Pointer [ , Init: Constructor ]);

Target

Windows, Real, Protected

Remarks

The Declaration of New has been extended so it can also initialize an object allocated on the heap, if you pass it that object's constructor as a second parameter, like this:

New(T, Init(360, 174));

New has also been extended to allow it to act as a function returning a pointer value.

The parameter passed to New is the type of the pointer to the object, rather than the pointer variable itself. This function form of New applies to all data types, not just object types. Like its procedure form, the function form of New can take the object type's constructor as a second parameter.