Re: question about forward declarations
Re: question about forward declarations
- Subject: Re: question about forward declarations
- From: "Erik M. Buck" <email@hidden>
- Date: Tue, 7 Aug 2001 14:14:43 -0500
First, your class names should start with a capital letter an a unique
prefix.
Second, try this:
////////////////////////////////////////////////////////////////////////////
///////////
//MYLauncher.h
#import <AppKit/AppKit.h>
@class MYMissile;
@interface MYLauncher : NSObject
{
MYMissile *_myMissile; // instance variables should
start with a lower case unique prefix
// and if they
are not public they shouls start with an _ IMHO
}
@end
////////////////////////////////////////////////////////////////////////////
///////////
//MYMissile.h
#import <AppKit/AppKit.h>
@class MYHuman;
@interface MYLauncher : NSObject
{
MYHuman *_myHuman; // instance variables should start
with a lower case unique prefix
// and if they
are not public they shouls start with an _ IMHO
}
@end
////////////////////////////////////////////////////////////////////////////
///////////
//MYHuman.h
#import "MYLauncher .h"
@interface MYHumanLauncher : MYLauncher // Classes should include
superclass name IMHO
// e.g. NSView, NSTextView
{
MYMissile *_myAnotherMissile; // MYHumanLauncher already
inherited _myMissile from
//
MYLauncher . Perhapse you want an array of missiles
// in
the MYLauncher class ?
}
@end
Subclasses must import the interface of their super class so that the
compiler knows how much memory to reserve and what instance variables are
available.
----- Original Message -----