Listing 14 (th_struc.hpp)

//  class StructThing -- a struct thing derived from
//  class Thing.
//
//  Version 1.01 -- 2/25/91
//
//  Michael Kelly -- Author
//
#if !defined(TH_STRUC_HPP)
#define TH_STRUC_HPP

#include "thing.hpp"

struct a_struct  {
    char  key[ 16 ];
    int   id;
};

class StructThing : public Thing {

  public:

    StructThing()
    {
   thing = new a_struct;
    }
    StructThing( a_struct &some_thing )
    {
   thing = new a_struct(some_thing);
    }

    long type()
    {
   return ( (long)StructType << 16) | sizeof(a_struct);
    }

    operator a_struct() { return *( (a_struct *)ptr() ); }

    void print();
    int  printable()  { return 1; }
    int  sortable()   { return 1; }

    operator ==(Thing &some_thing);
    operator !=(Thing &some_thing);
    operator < (Thing &some_thing);
    operator <=(Thing &some_thing);.
    operator > (Thing &some_thing);
    operator >=(Thing &some_thing);
};

#endif
// End of File