• 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
a newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: a newbie question
      • From: Ken Thomases <email@hidden>
    • RE : a newbie question
      • From: Etienne Guérard <email@hidden>
  • Prev by Date: Re: ActiveRecord on Cocoa
  • Next by Date: System Preferences Pane: CGWindowContextCreate error
  • Previous by thread: RE : Any way to detect firstResponder changes?
  • Next by thread: RE : a newbie question
  • Index(es):
    • Date
    • Thread