On Nov 11, 2008, at 9:21 AM, Etienne Guérard wrote:

You should derive your classes from NSObject, not from Object.
You normally don't have to #include <objc/Object.h>.
Where did you find such an example?


It is from Steve Kochan's book ...which is basically an introduction to Objective C.



The alloc method basically does a calloc of the appropriate instance size.
The init method of NSObject does nothing.
It's good practive to always call an init metod in your own constructor and when you create a new object.
So all you have to do is this:

Fraction *myFraction = [[Fraction alloc] init];

Don't forget to (auto)release this object when you're done.





Thank you._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to