Cocoa Dev Style: Using Class versus Object Methods
Cocoa Dev Style: Using Class versus Object Methods
- Subject: Cocoa Dev Style: Using Class versus Object Methods
- From: "Lee, Frederick" <email@hidden>
- Date: Thu, 7 Aug 2008 13:08:42 -0400
- Thread-topic: Cocoa Dev Style: Using Class versus Object Methods
Greetings:
I just came across a NSObject subclass written by someone, that
contains a couple of date/Time-processing methods (stringToDate,
visa-versa).
The methods were all class-level methods (+) vs (-); and hence, didn't
require the familiar alloc & init instantiation methods.
I've been writing NSObjects via instantiation (requiring alloc & init)
that I use to model business logic (packing XML data vectors, etc.) and
hold a lot of common methods to use.
I can see a project using class methods instead of instantiated methods;
and hence, avoid the alloc/init memory hassles.
My question (which is ELEMENTARY), is....
1) why use instantiated objects versus classes (via class methods)?
2) Are classes stored in the stack & instatiated objects on the
heap?
Ric.
_______________________________________________
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