Re: NSObject vs id
Kyle Sluder <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Sep 3, 2009 at 9:05 AM, Florent Lacheroy<[email protected]> wrote: > I wonder wether it is better to use NSObject or id. The compiler doesn't perform static type checking on expressions of type id. So as long as someone, somewhere has declared a -doFoo:withBar:baz: method, I can send that message to an id. Once you specify NSObject, though, the compiler assumes that your object only responds to messages in that interface/protocol. Makes "NSObject *foo" kind of useless unless you only need to send NSObject messages to it. --Kyle Sluder