a newbie question
a newbie question
- Subject: a newbie question
- From: Michael <email@hidden>
- Date: Mon, 10 Nov 2008 19:00:50 -0800
I am working from one of the numerous books in Obj C.
My question, which I have asked at another list, is about the method
init.
Firstly, here is the code, stripped somewhat of irrelevant
( hopefully ) code.
<<<<<<<<
/* #import <Foundation/Foundation.h> */
#import <stdio.h>
#import <objc/Object.h>
@interface Fraction : Object
{
int Numerator;
int Denominator;
}
-() methodsToImplementFraction;
@end
@implementation Fraction;
- ( void) methods{
doStuffHere;
}
@end
int main (int argc, const char * argv[]) {
Fraction *myFraction;
myFraction= [Fraction alloc];
myFraction= [Fraction init]; /* ??? */
return 0;
}
>>>>>>>>>
My question is this. As I step through the debugger in Xcode, it is
not that obvious that any change occurs with the code marked /* ???
*/. So, my question is , is there some fundamental thing that "init"
does ( for example, the member variables seem to be initialized with
the alloc method) ....and it obviously does...else it would not be
emphasized as much as it is...or will this become obvious later as I
work through more Obj-C.
Thanks in advance.
_______________________________________________
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