swift语言点评二十-扩展

结论:扩展无法修改原来的数据结构。

Extensions can add new functionality to a type, but they cannot override existing functionality.

If you define an extension to add new functionality to an existing type, the new functionality will be available on all existing instances of that type, even if they were created before the extension was defined.

Extensions can add new computed properties, but they cannot add stored properties, or add property observers to existing properties.

If you provide a new initializer with an extension, you are still responsible for making sure that each instance is fully initialized once the initializer completes.

原文地址:https://www.cnblogs.com/feng9exe/p/8745214.html