当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - Relationship between CFMutableDictionary and NSMutableDictionary

问题描述:

The following statement is taken from the 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.

Can someone please translate this into plain English? :-)

网友答案:

It means that everyplace you see NSMutableDictionary you can use CFMutableDictionary, and vice versa, without having an explicit conversion.

Since a concrete subclass of NSMutableDictionary IS A NSMutableDictionary, they also can be used anyplace CFMutableDictionary is used.

Basically a roundabout way of saying that the types can be implicitly converted between each other.

This link has some more information.

分享给朋友:
您可能感兴趣的文章:
随机阅读: