discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to initialise an array class inheriting from NSArray?


From: David Ayers
Subject: Re: How to initialise an array class inheriting from NSArray?
Date: Wed, 04 Jun 2003 14:10:04 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030507


  - (id) init
 {
   self = [super initWithObjects: ...];
   return self;
 }

I also would advise you to learn about categories...

http://developer.apple.com/techpubs/macosx/Cocoa/ObjectiveC/3objc_language_overview/index.html
http://developer.apple.com/techpubs/macosx/Cocoa/ObjectiveC/3objc_language_overview/chapter_3_section_8.html

... before learning how to sublcass the abstract classes from class clusters such as NSArray.

All previously cited code examples (as above) would not return an instance of your class, but of a private subclass of the class cluster, which doesn't implement your additional methods. Yet if you think a subclass is "The Right Thing" then please read:

http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/Foundation/Concepts/ClassClusters.html

Cheers,
David






reply via email to

[Prev in Thread] Current Thread [Next in Thread]