Может ли кто -нибудь привести пример прямой объявления в объективном C для обычного класса, а не для категории или протокола?

StackOverflow https://stackoverflow.com/questions/4862717

Вопрос

Может ли кто -нибудь привести пример прямой объявления в объективном C для обычного класса, а не для категории или протокола?

Это было полезно?

Решение

/*
  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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top