SomDefaultAssign

This method provides support for an object-assignment operator. May be overridden, but, if appropriate, somDefaultConstAssign should be overridden instead.


 * Original Class : SOMObject

Syntax
void somDefaultAssign (SOMObject receiver, somInitCtrl ctrl, SOMObject fromObj)

Parameters
A pointer to an object of an arbitrary SOM class, S.
 * receiver (SOMObject):

A pointer to a somInitCtrl structure, or NULL.
 * ctrl (somInitCtrl):

A pointer to an object of class S or some class descended from S.
 * fromObj (SOMObject) :

Return Code
rc (void)

Remarks
In C++, assignment to an object of class "X" is accomplished by using (an appropriate overloading of) the assignment operator provided by "X". To make assignment available on all SOM objects, SOMObject provides the somDefaultAssign and somDefaultConstAssign methods. The default behavior of these methods is that they do a shallow copy of data from one object to another. Users should generally use the somDefaultAssign method for doing object assignment.

When a shallow copy is not appropriate for the data introduced by a class, and it is possible to perform the copy without modifying fromObj, it is recommended that the class implementor override the somDefaultConstAssign method for that class.

The considerations important to overriding somDefaultAssign are similar to those described in the SOM Programming Guide for overriding somDefaultInit. (See "Initializing and Uninitializing Objects" in Chapter 5, "Implementing Classes in SOM.") The basic difference between somDefaultInit and somDefaultAssign is that the latter method takes an object (fromObj) as a source argument for assignment of values to the receiver.

Example Code
 // C++ SOMObjects Toolkit Code
 * 1) include 

main {       X *x = new X;        Y *y = new Y;  // assume Y is derived from X        x->somDefaultAssign(0,y) // the x object has now been assigned values from y } 

Methods

 * somDefaultInit
 * somDefaultConstAssign
 * somDefaultCopyInit
 * somDefaultConstCopyInit