Using Renew

After verifying that the <className> class object exists, the <className>Renew macro invokes the somRenew method on the class object. <className>Renew is only used when the space for the object has been allocated previously. (Perhaps the space holds an old uninitialized object that is not needed anymore.) This macro converts the given space into a new, initialized instance of <className> and returns a pointer to it. The programmer is responsible for ensuring that the argument of <className>Renew points to a block of storage large enough to hold an instance of class <className>. The SOM method somGetInstanceSize can be invoked on the class to determine the amount of memory required. Like <className>New, the <className>Renew macro automatically creates any required class objects that have not already been created.

Hint: When creating a large number of class instances, it may be more efficient to allocate at once enough memory to hold all the instances, and then invoke <className>Renew once for each object to be created, rather than performing separate memory allocations.


[Back: Using New]
[Next: Using NewClass]