Open iugo opened 1 year ago
官方详细文档在: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/classesandstructures/
其中, 最重要的是一句话是:
因为 class 更复杂, 所以优先使用 struct.
如果还有疑问, 参见另一份官方文档: https://developer.apple.com/documentation/swift/choosing-between-structures-and-classes
除了继承, 基本上 struct 实现了所有 class 的常见功能.
官方详细文档在: https://docs.swift.org/swift-book/documentation/the-swift-programming-language/classesandstructures/
其中, 最重要的是一句话是:
因为 class 更复杂, 所以优先使用 struct.
如果还有疑问, 参见另一份官方文档: https://developer.apple.com/documentation/swift/choosing-between-structures-and-classes
struct 有哪些功能
除了继承, 基本上 struct 实现了所有 class 的常见功能.