To complete the class-implementation process, you modify the C-language source-program template as shown in the following sample code. You must supply the code for each of the stubbed method procedures. In the example, "dog barking" is implemented as "printing the sound a dog makes," or, printing "Unknown dog noise." Because the C-library printf routine is used to implement this function, STDIO.H also must be included in the source program.

/*
 *  This file was generated by the SOM compiler and Emitter framework.
 *  Generated using: SOM Emitter emitctm: 2.38
 */

#ifndef SOM_Module_dog3_Source
#define SOM_Module_dog3_Source
#endif

#define Dog_Class_Source

#include "dog3.ih"

/* This line is added because of the printf statement below */
#include <stdio.h>

/*
 * Have the dog bark
 */

SOM_Scope void  SOMLINK Bark(Dog *somSelf)
{
   /* DogData *somThis = DogGetData(somSelf); */
   DogMethodDebug("Dog","Bark");
   printf("Unknown dog noise\n");     /* The dog now speaks... */
}


[Back] [Next]