• 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
Usage of +class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Usage of +class


  • Subject: Usage of +class
  • From: Jonathon Mah <email@hidden>
  • Date: Sat, 22 Apr 2006 18:35:15 +0930

Hi all,

I've had a question nagging at the back of my mind for the past few days: What is the general convention for using +class?

For example, my Cocoa instincts tell me to do this:

[MyView poseAsClass:[NSView class]]; // 1

But there are two other possibilities:
[MyView poseAsClass:NSView]; // 2
and
[[MyView class] poseAsClass:[NSView class]]; // 3

Here's one train of thought: (2) is preferred, but (1) is should be used in practice. NSView should be sent any message (in this case, +class) to make sure that it has been +initialized and all that. The first call to +class in (3) is pointless.

Is that the case?



Jonathon Mah
email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Usage of +class
      • From: j o a r <email@hidden>
  • Prev by Date: display images in popupbutton
  • Next by Date: Core Data Merged Models
  • Previous by thread: Re: display images in popupbutton
  • Next by thread: Re: Usage of +class
  • Index(es):
    • Date
    • Thread