swift介绍中struct和class的区别

来源:互联网 发布:淘宝网一元秒杀专区 编辑:程序博客网 时间:2024/06/05 20:15

“Structures support many of the same behaviors as classes, including methods and initializers.

 One of the most important differences between structures and classes is that 

structures are always copied when they are passed around in your code,

 but classes are passed by reference.”



摘录来自: Apple Inc. “The Swift Programming Language”。 iBooks. https://itun.es/cn/jEUH0.l


这是swift中struct 和class的区别。

不过我还是没弄懂c++中他俩的实质性区别

0 0
原创粉丝点击