BrT

Musings about technology and other neat stuff

BrT random header image

WILTAC #2: Designated initializers

October 10th, 2008 · No Comments

I learned today the term designated initializer:

When a class has multiple initializers, the designated initializer is the one that actually does the work, normally the one with the most parameters. All other initializers call the designated one, providing different amounts of default parameter values.

I was aware of the concept – many classes have initializers with varying numbers of parameters, with the “simplest” ones setting things to default values, and the more complex ones allowing greater control. I didn’t know the term.

I found two other uses for the term designated initializer:

  • In the C99 language specification, you can selectively initialize elements in an aggregate data structure, this construct is called a designated initializer.
  • It’s the title of a song performed at WWDC 08 by James Dempsey and the Breakpoints (of course, related to the Objective-C definition).

Tags: · · · ·