Usage of +class
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