Skip to content

Instantly share code, notes, and snippets.

@chrisdevereux
Created August 28, 2011 18:20
Show Gist options
  • Select an option

  • Save chrisdevereux/1177004 to your computer and use it in GitHub Desktop.

Select an option

Save chrisdevereux/1177004 to your computer and use it in GitHub Desktop.

Revisions

  1. chrisdevereux created this gist Aug 28, 2011.
    45 changes: 45 additions & 0 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    #import <Cocoa/Cocoa.h>

    @protocol IdMethod
    + (id) method;
    @end

    @interface IdClass : NSObject <IdMethod>
    @end

    @implementation IdClass
    + (id) method
    {
    return @"hello!!";
    }
    @end



    @protocol StructMethod
    + (NSRect) method;
    @end

    @interface StructClass : NSObject <StructMethod>
    @end

    @implementation StructClass
    + (NSRect) method
    {
    return CGRectMake(5,5,5,5);
    }
    @end

    int main (int argc, char const *argv[])
    {
    NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

    Class<IdMethod> a = [IdClass class];
    NSLog(@"%@", [a method]);

    Class<StructMethod> b = [StructClass class];
    NSLog(@"%@", NSStringFromRect([b method]));

    [pool drain];
    return 0;
    }