SomNewNoInit

This method creates a new instance of a class.

For backward compatibility, this method does not take an Environment parameter.


 * Original Class : SOMClass

Syntax
SOMObject somNewNoInit (SOMClass receiver)

Parameters

 * receiver (SOMClass) : A pointer to the class object that is to create a new instance.

Return Code

 * rc (SOMObject) : A pointer to the newly created SOMObject object, or NULL.

Remarks
The somNew and somNewNoInit methods create a new instance of the receiving class. Space is allocated as necessary to hold the new object.

When either of these methods is applied to a class, the result is a new instance of that class. If the receiver class is SOMClass or a class derived from SOMClass, the new object will be a class object; otherwise, the new object will not be a class object. The somNew method invokes the somDefaultInit method on the newly created object. The somNewNoInit method does not.

Either method can fail to allocate enough memory to hold a new object and, if so, NULL is returned.

The SOM Compiler generates convenience macros for creating instances of each class, for use by C and C++ programmers. These macros can be used in place of this method.

Example Code

 * 1) include 

void main {   Animal myAnimal; /*-- Note: next 2 lines are functionally equivalent to         myAnimal = AnimalNew; - */   /* Create class object: */ AnimalNewClass(Animal_MajorVersion, AnimalMinorVersion); myAnimal = _somNew(_Animal); /* Create instance of Animal cls */ /* ... */   _somFree(myAnimal);       /* Free instance of Animal */ } 

Methods

 * somRenew