What does the term “opaque type” mean in the context of “CFBundleRef opaque type”?

后端 未结 3 1114
暗喜
暗喜 2021-01-30 11:01

Does someone have a good explanation of what an \"opaque type\" is? I saw that term in context of the CFBundleRef, where they were saying: \"CFBundleRef opaque type

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 12:00

    An opaque type is a type that "wraps" lower-level types, and is often used when either the underlying implementation is complex, or the user simply does not need to know about the inner workings. Apple has a good page on opaque types here:

    https://developer.apple.com/library/ios/#documentation/CoreFoundation/Conceptual/CFDesignConcepts/Articles/OpaqueTypes.html

    For example, CFString is an opaque type because it wraps a character array, maintains its length, its encoding, etc., but does not directly allow the user to access these values. Rather it provides methods that access or manipulate internal fields and return to the user the relevant information.

提交回复
热议问题