#include <somobj.idl>
#include <somcls.idl>

//  The classes in this module illustrate the use of a simple
//  metaclass to provide customized constructors and to perform
//  basic instance tracking.


    interface Animal : SOMObject
    {
      typedef sequence<Animal> AnimalInstances;

      attribute string name;
      // The name of the animal.

      attribute string sound;
      // The kind of sound that an animal makes.

      readonly attribute string genus;
      // The genus of animal.
      // The "_get_" method for this attribute should be overridden
      // by derived classes.  The default version here just gives
      // "<unknown>" as the genus.

      readonly attribute string species;
      // The species of animal.
      // The "_get" method for this attribute should be overridden
      // by derived classes.  The default version here just gives
      // "<unknown>" as the species.

      void talk();
      // Ask the animal to talk.  Normally this just prints out the
      // string corresponding to the sound attribute, but it can be
      // overridden to do something else.

      void display();
      // Displays an animal.	Derived classes should override this to
      // display new derived information, and then call their parent
      // version. Note: this method makes use of talk() to describe what
      // the animal says.

#ifdef __SOMIDL__
      implementation {
         releaseorder: _get_name, _set_name, _get_sound, _set_sound,
                       _get_genus, _get_species, talk, display;
	
         //# Class Modifiers
         functionprefix = animal_;
         callstyle      = oidl;
         dllname        = "animals.dll";

         //# Internal Instance Variables (other than attributes)
         long nsound;

         //# Attribute modifiers
         name: noset;
         sound: noset;
         genus: nodata;
         species: nodata;

         //# Method Modifiers
         somFree: override;
         somInit: override;
         somUninit: override;
         somDumpSelfInt: override;
      };
#endif /* __SOMIDL__ */
    };
