• 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
Cocoa Dev Style: Using Class versus Object Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Cocoa Dev Style: Using Class versus Object Methods
      • From: Ian Joyner <email@hidden>
    • Re: Cocoa Dev Style: Using Class versus Object Methods
      • From: Graham Cox <email@hidden>
    • Re: Cocoa Dev Style: Using Class versus Object Methods
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: Bindings to display an NSArray of NSStrings as a single NSString?
  • Next by Date: Application control
  • Previous by thread: Re: Problem with friend function and gcc 4.2 with objective-c++
  • Next by thread: Re: Cocoa Dev Style: Using Class versus Object Methods
  • Index(es):
    • Date
    • Thread