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

Re: Noob question regarding Cocoa objects.


  • Subject: Re: Noob question regarding Cocoa objects.
  • From: "David Symonds" <email@hidden>
  • Date: Tue, 28 Nov 2006 14:22:03 +1100

On 11/28/06, dan <email@hidden> wrote:
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?

Almost; the combination of the 'alloc' message and the 'init' message are closer to being the equivalent.

-------------------------------
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?

Usually, yes. It will be up to each class to propogate the 'init' message, and normally they should have a [super init] call inside their own init method.

-------------------------------
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?

Yes.



Dave.

--
"Strange women lying in ponds distributing swords
 is no basis for a system of government."
_______________________________________________

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


References: 
 >Noob question regarding Cocoa objects. (From: dan <email@hidden>)

  • Prev by Date: Re: Noob question regarding Cocoa objects.
  • Next by Date: Re: Invalid number in bound text field
  • Previous by thread: Re: Noob question regarding Cocoa objects.
  • Next by thread: Re: Noob question regarding Cocoa objects.
  • Index(es):
    • Date
    • Thread