• 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: References to classess
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: References to classess


  • Subject: Re: References to classess
  • From: Ben Kennedy <email@hidden>
  • Date: Thu, 25 Apr 2002 15:53:48 -0400

On 25,04,02 at 3:29 pm -0400, Al Kirkus wrote:

>I have a class structure in which one class uses another but the other
>uses the first. I can get it to compile by using the @class directive
>instead of including the one of the header files but I receive warnings like:
>
>Record.m:27: warning: `Column' does not respond to `retain'
>
>The Column class is the one I used @class on.

First of all, you usually retain and release instances of classes, not
class objects themselves, so it sounds like you have something fishy
going on in your code there.

However, you should be able to make the mutual referencing work by using
a forward declaration in the header file and importing the full header in
the implementation file, ` la:

// in ClassA.h:

@class ClassB;
@interface ClassA // ....

// in ClassA.m:

#import "ClassB.h"
@implementation ClassA // ....


I do this in several places and it works well.

-ben

--
Ben Kennedy, chief magician
zygoat creative technical services
613-228-3392 | 1-866-466-4628
http://www.zygoat.ca
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >References to classess (From: "Al Kirkus" <email@hidden>)

  • Prev by Date: Re: Development of database applications
  • Next by Date: NSTableView and NSImage
  • Previous by thread: References to classess
  • Next by thread: Re: References to classess
  • Index(es):
    • Date
    • Thread