somPrintSelf

From EDM2
Revision as of 02:04, 13 October 2017 by Martini (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This method outputs a brief description that identifies the receiving object. Designed to be overridden.

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

Original Class 
SOMObject

Syntax

SOMObject somPrintSelf (SOMObject receiver)

Parameters

receiver (SOMObject) 
A pointer to the object to be described.

Return Code

rc (SOMObject) 
Returns a pointer to the receiver object as its result.

Remarks

somPrintSelf should output a brief string containing key information useful to identify the receiver object, rather than a complete dump of the receiver object state as provided by somDumpSelfInt. The somPrintSelf method should use the character output routine SOMOutCharRoutine (or any of the somPrintf functions) for this purpose. The default implementation outputs the name of the receiver object's class and the receiver's address in memory.

Because the most specific identifying information for an object will often be found within instance data introduced by the class of an object, it is likely that a class implementor that overrides this method will not need to invoke parent methods in order to provide a useful string identifying the receiver object.

Example Code

#include <animal.h>
main()
{
  Animal myAnimal;
  myAnimal = AnimalNew ();
  /* ... */
  _somPrintSelf (myAnimal);
  _somFree (myAnimal);
}
/*
Output from this program:

{An instance of class Animal at address 0001CEC0}
*/

Related

Methods