9

任何人都可以在目标 C 中为普通类而不是类别或协议提供前向声明的示例吗?

4

1 回答 1

9
/*
  using a forward declaration of NSDocument, there's no need
  for every source that encounters this header to include AppKit,
  allowing much faster compile times and reducing dependency
  changes for clients.

  of course, MONThang.m will need to include AppKit to use NSDocument
  - but the clients using MONThang do not need to import AppKit.
*/

@class NSDocument; // << the forward declaration

@interface MONThang : NSObject
{
    NSDocument * document;
}

@end
于 2011-02-01T12:48:14.890 回答