Obj-C, class methods and instance methods
Obj-C, class methods and instance methods
- Subject: Obj-C, class methods and instance methods
- From: "Sanj W." <email@hidden>
- Date: Sun, 19 May 2002 13:12:16 -0400
Hi,
Im trying to understand the difference between class methods and instance
methods in Obj-C. I thought that class methods are similar to static methods
in Java, where one could call the method without instantiating an class.
However, I could write the following class without a constructor (init) and
have an instance method (an IBAction) and get the system to call it (by
merely connecting in IB).
* How does this work? It would have made sense to me if myAction was
declared as a class method.
+(IBAction)myAction:(id)sender
* Is there a default constructor in in the following class that I declared?
<CODE IN QUESTION>
#import "MyClass.h"
@implementation MyClass
- (IBAction)myAction:(id)sender
{
//implementation...
}
@end
</CODE IN QUESTION>
Thanks,
Sanj
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.