Created
November 10, 2013 17:03
Revisions
-
theiostream revised this gist
Nov 10, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,4 +33,4 @@ - (void)dealloc { Initialization: Pair *x = [[Pair alloc] initWithObjects:obj1, obj2]; Member Getting: x->obj1; x->obj2; Member setting: x->obj1 = [obj1 retain]; x->obj2 = [obj2 retain]; Releasing: [x release]; */ -
theiostream created this gist
Nov 10, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ @interface Pair : NSObject { @public id obj1; id obj2; } - (id)initWithObjects:(id)object, ...; @end @implementation Pair - (id)initWithObjects:(id)object, ... { if ((self = [super init])) { va_list args; va_start(args, object); obj1 = [object retain]; obj2 = [va_arg(args, id) retain]; va_end(args); } return self; } - (void)dealloc { [obj1 release]; [obj2 release]; [super dealloc]; } @end /* A simple Obj-C pair! Initialization: Pair *x = [[Pair alloc] initWithObjects:obj1, obj2]; Member Getting: x->obj1; x->obj2; Member setting: x->obj1 = [obj1 retain]; x->obj2 = [obj2 retain]; Releasing: [x release];