Re: Convenience Methods
Re: Convenience Methods
- Subject: Re: Convenience Methods
- From: Uli Kusterer <email@hidden>
- Date: Wed, 26 Sep 2007 23:28:47 +0200
Am 26.09.2007 um 03:38 schrieb Nick Zitzmann:
You should always return an object of type id, so that the class
method will work correctly with subclasses of the object.
Just to avoid confusion:
- It's a convention to have convenience methods declared with a
return type of "id". I'm not sure why. If you declare your
convenience method to return a MyObject*, and your subclass also uses
the return type MyObject*, that's completely OK. Subclasses of
MyObject are valid MyObjects, too.
- You *can not* return an *object* of type id, because id is an
abstract type. There is no way to instantiate an id. This is mainly
just terminology nitpicking, but maybe it saves some beginner a lot
of time confusedly trying to come up with a way to instantiate an id...
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden