• 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
Noob question regarding Cocoa objects.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Noob question regarding Cocoa objects.


  • Subject: Noob question regarding Cocoa objects.
  • From: dan <email@hidden>
  • Date: Mon, 27 Nov 2006 22:07:08 -0500

I'm learning objective-c with Cocoa coming from a Java background. Have some questions to make sure I'm on the right track.
-------------------------------
1-I'm thinking an objective-c object's init method is basically equivalent to a Java's class constructor?
-------------------------------
2-By calling init (To initialize an object) it reaches the top most object (NSObject) while executing all the init in the object tree?
Let's say there's objects A through Z, and Z inherits from NSObject.
So [a init] will call init inside B through NSObject?
-------------------------------
3-Guessing my own objects (That I created) does not have to have an "init" - but it could be labeled as "initWithParam", etc. But I would have to create a logic that calls the super class init?
-------------------------------
4-Working with objects I think of alloc and init. But some objects offer methods that does it for you? (Basically my last question with an example)


Using NSString...
NSString *string1 = [NSString stringWithString:@"this is a test"];

Here stringWithString: actually fires off NSString init?
-------------------------------
Thanks







_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Noob question regarding Cocoa objects.
      • From: James Bucanek <email@hidden>
    • Re: Noob question regarding Cocoa objects.
      • From: Scott Stevenson <email@hidden>
    • Re: Noob question regarding Cocoa objects.
      • From: Scott Ribe <email@hidden>
    • Re: Noob question regarding Cocoa objects.
      • From: "Kirt Cathey" <email@hidden>
    • Re: Noob question regarding Cocoa objects.
      • From: "David Symonds" <email@hidden>
    • Re: Noob question regarding Cocoa objects.
      • From: Murat Konar <email@hidden>
  • Prev by Date: Re: Should I do loops in reverse order ?
  • Next by Date: Re: Noob question regarding Cocoa objects.
  • Previous by thread: Re: Invalid number in bound text field
  • Next by thread: Re: Noob question regarding Cocoa objects.
  • Index(es):
    • Date
    • Thread