Re: A simple Objective-C question
Re: A simple Objective-C question
- Subject: Re: A simple Objective-C question
- From: Michael Vannorsdel <email@hidden>
- Date: Thu, 10 Apr 2008 12:28:50 -0600
You'll want to make all basic classes a subclass of NSObject so alloc/
dealloc, retain/release function properly. Unless you really want to
implement you're own alloc/dealloc method, but I think that's
unnecessary work.
On Apr 10, 2008, at 12:22 PM, Rama Krishna wrote:
I am new to Objective-C but I have done C++/C#/Java work. I have
been doing
some experiments to understand how the language works. I found that
it is
not necessary for an Objective-C class to derive from Object. I was
able to
create a class which did not derive from Object contrary to my
assumption
that all Objective-C classes implicitly derive from Object (such as
in C# or
Java).
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.
_______________________________________________
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