Creating and Destroying Instances
Creating a new instance of an object is called instantiating the object. Instantiating in steve is done using the new command. Instantiation creates a single new instance if no number is given, or as many objects as you want by preceding the command with a number. The syntax follows:
new object_type. number new object_type.
If a single object is created, it is returned as an object type. If several are created, they are returned as a list. For example:
myBird (object). myBugs (list). myBird = new Bird. myBugs = 100 new Bugs.
The method init is called automatically for a class and all of its superclasses when the class is instantiated.
Destroying instances is simply accomplished using the command free:
free instance.
free accepts both single instances and lists of instances.
If an instance frees itself, then execution of the code is stopped immediately, as though the free command was followed by a return.
When an object is freed, the destroy method is automatically called for the instance. Prior to version 1.9, destroy would automatically
be called for all superclasses. This is no longer the case—you must call "super destroy" if you wish for the superclass destroy method to be run.
