• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: "Designated Initializer" pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Re: "Designated Initializer" pattern (From: Reed Hedges <email@hidden>)

  • Prev by Date: Re: "Designated Initializer" pattern
  • Next by Date: Loading an bitmap from NSImage with alpha?
  • Previous by thread: Re: "Designated Initializer" pattern
  • Next by thread: Re: "Designated Initializer" pattern
  • Index(es):
    • Date
    • Thread