- 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
推薦閱讀
- 數據庫應用實戰
- Game Development with Swift
- Python廣告數據挖掘與分析實戰
- MySQL從入門到精通(第3版)
- Learning JavaScriptMVC
- 數據革命:大數據價值實現方法、技術與案例
- OracleDBA實戰攻略:運維管理、診斷優化、高可用與最佳實踐
- 基于OPAC日志的高校圖書館用戶信息需求與檢索行為研究
- LabVIEW 完全自學手冊
- Proxmox VE超融合集群實踐真傳
- 數據庫應用系統開發實例
- 大數據分析:數據倉庫項目實戰
- Scratch 2.0 Game Development HOTSHOT
- 數據中臺實戰:手把手教你搭建數據中臺
- Visual Studio 2012 and .NET 4.5 Expert Development Cookbook