RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TInvokableClass.NewInstance Method

Allocates memory for each instance of an invokable object.

Pascal
class function NewInstance: TObject; override;
C++
virtual __fastcall TObject * NewInstance();

Constructors call NewInstance automatically. NewInstance calls InstanceSize to determine how much memory to allocate from the heap to contain a particular instance. Do not call NewInstance directly.  

TInvokableClass overrides NewInstance to increment the reference count when a new instance is created. This prevents any constructor from accidentally deleting the instance due to a RefCount of zero. The AfterConstruction method decrements the value of RefCount after all constructors have executed. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!