gpt4 book ai didi

objective-c - 任何人都可以举例说明在 Objective-C 中针对普通类而不是类别或协议(protocol)的前向声明吗?

转载 作者:太空狗 更新时间:2023-10-30 03:29:07 24 4
gpt4 key购买 nike

谁能给出在 Objective-C 中针对普通类而不是类别或协议(protocol)的前向声明的示例?

最佳答案

/*
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

关于objective-c - 任何人都可以举例说明在 Objective-C 中针对普通类而不是类别或协议(protocol)的前向声明吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862717/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com