RAD Studio VCL Reference
|
Allocates memory for an instance of an object type and returns a pointer to that new instance.
class function NewInstance: TObject; override;
virtual __fastcall TObject * NewInstance();
All constructors call System::TObject::NewInstance automatically. System::TObject::NewInstance calls System::TObject::InstanceSize to determine how much memory to allocate from the heap to contain a particular instance. Do not call System::TObject::NewInstance directly.
Override System::TObject::NewInstance only for special memory allocation requirements. For example, when allocating a large number of identical objects that all need to be in memory at the same time, you could allocate a single block of memory for the entire group, then override System::TObject::NewInstance to use part of that larger block for each instance.
If you override System::TObject::NewInstance to allocate memory, you may need to override System::TObject::FreeInstance to deallocate the memory.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|