Quelqu'un peut-il donner l'exemple de la déclaration en avant dans C objectif pour une classe normale et non pour la catégorie ou le protocole?

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

Question

Quelqu'un peut-il donner l'exemple de la déclaration en avant dans C objectif pour une classe normale et non pour la catégorie ou le protocole?

Était-ce utile?

La solution

/*
  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
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top