I am developing CHDataStructures , a Cocoa data structure library, to complement them in Foundation. It includes a fair number of classes (stacks, queues, and queues) that have common implementation details, so it makes sense to design them using a common parent class, which I consider abstract (Objective-C does not provide an intrusive application of this concept). For example, CHAbstractCircularBufferCollection encapsulates almost all the logic for structures that use a circular buffer under covers. Its child classes inherit the basic types of behavior and correspond to the corresponding protocol, therefore only methods related to this protocol are added. (Thus, the queue does not provide stack methods, etc.)
This works fine, and the validity and scope are checked using unit tests . However, the drawback of the current approach is that each specific subclass has a #importheader for the abstract parent class to include (see this header and implementation ) - this means that I need to export the parent class headers in order to compile the client code. It would be ideal if there was a way to use @classin the header rather than #import, so the calling code should not know or care about the abstract parent class. (This will also simplify and reduce the size of the frame.) However, when I try this:
#import "CHQueue.h"
@class CHAbstractCircularBufferCollection;
@interface CHCircularBufferQueue : CHAbstractCircularBufferCollection <CHQueue>
@end
I get this error even if I am #import CHAbstractCircularBufferCollection.hin the .m file:
"CHAbstractCircularBufferCollection", "CHCircularBufferQueue"
, , , . , , ?
PS. , , Foundation, . , , , .