Listing 7 (th_int.cpp)

//
//  class IntThing  --  an integer thing derived from
//              class Thing.
//
//  Version 1.01  --  2/25/91
//
//  Michael Kelly --  Author
//
#include <stdio.h>
#include "th_int.hpp"

void IntThing::print()
{
    printf("%d\n", (int)*this);
}

IntThing::operator ==(Thing &some_thing)
{
    return (type() == some_thing.type() ) ?
      ( *((int *)ptr() )==*((int *)some_thing.ptr()) ) : 0;
}

IntThing::operator !=(Thing &some_thing)
{
    return ( type() == some_thing.type() ) ?
      ( *((int *)ptr()) != *((int *)some_thing.ptr()) ): 0;
}

IntThing::operator < (Thing &some_thing)
{
    return (type() == some_thing.type() ) ?
      ( *((int *)ptr()) <  *((int *)some_thing.ptr()) ): 0;
}

IntThing::operator <=(Thing &some_thing)
{
    return ( type() == some_thing.type() ) ?
      ( *((int *)ptr()) <= *((int *)some_thing.ptr()) ): 0;
}

IntThing::operator > (Thing &some_thing)
{
    return ( type() == some_thing.type() ) ?
      ( *((int *)ptr()) > *((int *)some_thing.ptr()) ) : 0;
}

IntThing::operator > = (Thing &some_thing)
{
    return ( type() == some_thing.type()) ?
      ( *((int *)ptr() >= *((int *)some_thing.ptr()) ) : 0;
}

// End of File