gpt4 book ai didi

objective-c - CFMutableDictionary 和 NSMutableDictionary 的关系

转载 作者:行者123 更新时间:2023-12-03 17:29:26 26 4
gpt4 key购买 nike

以下声明摘自 CFMutableDictionary Reference section of the Mac OS X Reference Library :

CFMutableDictionary is “toll-free bridged” with its Cocoa Foundation counterpart, NSMutableDictionary. What this means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. This means that in a method where you see an NSMutableDictionary * parameter, you can pass in a CFMutableDictionaryRef, and in a function where you see a CFMutableDictionaryRef parameter, you can pass in an NSMutableDictionary instance. This also applies to concrete subclasses of NSMutableDictionary. See Interchangeable Data Types for more information on toll-free bridging.

有人可以将其翻译成简单的英语吗? :-)

最佳答案

这意味着在您看到 NSMutableDictionary 的每个地方都可以使用 CFMutableDictionary,反之亦然,而无需显式转换。

由于 NSMutableDictionary 是 NSMutableDictionary 的具体子类,所以它们也可以在任何使用 CFMutableDictionary 的地方使用。

基本上是一种迂回的方式,表示类型可以在彼此之间隐式转换。

这个link有更多信息。

关于objective-c - CFMutableDictionary 和 NSMutableDictionary 的关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1439547/

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