next up previous contents
Next: An Example - The Up: Writing a C Module Previous: Throwing Exceptions   Contents

Init and Exit Routines

To assure that the initial state of an object always is the desired, each class need to have a proper initialization routine. It is not safe to only set initial values in the create() method of a class since this method is not certain to be run. This is the case when a class is being inherited. Therefore, initialization of classes is required to be done in the initialization callback. So we need to add an initialization for each class in the module.

If needed, proper exit routines should also be written. Their task is to do cleanup before the object is garbage collected.



2003-03-04