#import <Foundation/Foundation.h>

static NSString *
myObjectDescription(id self, SEL _cmd)
{
  return [NSString stringWithFormat: @"[MyObject:%p]", self];
}

int
main(void)
{
  id obj;
  Class cls;
  NSAutoreleasePool *pool;

  pool = [NSAutoreleasePool new];
  cls = (Class)objc_allocateClassPair([NSObject class], "MyObject", 0);
  if (cls != Nil)
    {
      objc_registerClassPair(cls);
      class_addMethod(cls, @selector(description),
		      (IMP)myObjectDescription, "@@:");
      obj = [cls new];
      printf("new object is: %s\n", [[obj description] UTF8String]);
      [obj release];
    }
  [pool release];

  return 0;
}
