• 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: A simple Objective-C question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A simple Objective-C question


  • Subject: Re: A simple Objective-C question
  • From: "stephen joseph butler" <email@hidden>
  • Date: Thu, 10 Apr 2008 13:55:11 -0500

On Thu, Apr 10, 2008 at 1:22 PM, Rama Krishna <email@hidden> wrote:

> However, such a class has a problem. It cannot be allocated or
> initialized.
> Because it can never get the alloc message as the alloc message is
> declared
> in the Object class. My question ,therefore, is how can such classes be
> instantiated. Is there a library function for that? Surely, the standard
> alloc function must be using such a function. Or should I just derive all
> classes from Object.
>

I could be wrong, but I think you can build a +alloc message using
NSAllocateObject. However, to make your class behave well with the rest of
Cocoa, you'll also need to implement a large part of the NSObject protocol.

Unless you have a very good reason (no offense, but beginners rarely do)
then you should inherit from NSObject instead.
_______________________________________________

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

References: 
 >A simple Objective-C question (From: "Rama Krishna" <email@hidden>)

  • Prev by Date: Re: A simple Objective-C question
  • Next by Date: Re: [OFF] unicode characters
  • Previous by thread: Re: A simple Objective-C question
  • Next by thread: Re: A simple Objective-C question
  • Index(es):
    • Date
    • Thread