- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 114字
- 2021-07-02 23:54:28
Choosing between classes and structures
Consider creating a structure when one or more of the following conditions apply:
- The structure's primary purpose is to encapsulate a few relatively simple data values
- It is reasonable to expect that the encapsulated values will be copied rather than referenced when you assign or pass around an instance of the structure
- Any properties stored by the structure are themselves value types, which would also be expected to be copied rather than referenced
- The structure does not need to inherit properties or behavior from another existing type
Examples of good candidates for structures include the following:
- The size of a geometric shape
- A point in a 3D coordinate system
推薦閱讀
- Access 2016數據庫教程(微課版·第2版)
- 有趣的二進制:軟件安全與逆向分析
- Architects of Intelligence
- Python數據分析、挖掘與可視化從入門到精通
- Ceph源碼分析
- 高維數據分析預處理技術
- 達夢數據庫運維實戰
- 重復數據刪除技術:面向大數據管理的縮減技術
- Python數據分析與數據化運營
- 活用數據:驅動業務的數據分析實戰
- Oracle高性能SQL引擎剖析:SQL優化與調優機制詳解
- SQL Server 2008寶典(第2版)
- Scratch 2.0 Game Development HOTSHOT
- Swift Functional Programming(Second Edition)
- 領域驅動設計精粹