Re: "Designated Initializer" pattern
Re: "Designated Initializer" pattern
- Subject: Re: "Designated Initializer" pattern
- From: Ondra Cada <email@hidden>
- Date: Wed, 17 Mar 2004 01:43:50 +0100
Reed,
On Wednesday, Mar 17, 2004, at 00:41 Europe/Prague, Reed Hedges wrote:
Do I misunderstand what exactly you mean...
int foo(int x, int y, int z, bool flag) {
}
int bar(int x) {
return foo(x, 0, 0, 0, false);
}
int baz(int y) {
return foo(23, y, 42, true);
}
right?
Well, presumed I understood right the original question, the small
difference is that it would rather be
-(int)foo:(int)x y:(int)y z:(int)z flag:(BOOL)flag { ... }
-(int)bar:(int)x { return [self foo:x y:0 z:0 flag:NO]; }
-(int)baz:(int)y { return [self foo:23 y:y z:42 flag:YES]; }
And, with the added benefit of inheritance, it suddenly becomes a
*very* potent pattern, indeed worth a name of itself.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.