What's the difference between formal and informal protocols in Objective-C?

后端 未结 3 2116
南方客
南方客 2021-01-31 03:04

What\'s the difference between formal and informal protocols in Objective-C?

3条回答
  •  庸人自扰
    2021-01-31 03:26

    The Objective-C language provides a way to formally declare a list of methods (including declared properties) as a protocol. Formal protocols are supported by the language and the runtime system. For example, the compiler can check for types based on protocols, and objects can introspect at runtime to report whether or not they conform to a protocol.

提交回复
热议问题