- iOS Programming Cookbook
- Hossam Ghareeb
- 86字
- 2021-07-09 18:29:42
Class-only protocols
We mentioned before that classes, structures, and enumerations could adopt protocols. The difference among them is that classes are reference types, whereas structures and enumerations are value types. If you find yourself having some specific actions that will be done only via reference types, mark it as class only. To do so, just mark it as follows:
protocol ClassOnlyProtocol: class{ // class only properties and methods go here }
Add a colon : and the class keyword to mark your protocol as class only.
推薦閱讀
- Mastering ElasticSearch
- 樂(lè)學(xué)Windows操作系統(tǒng)
- Linux系統(tǒng)文件安全實(shí)戰(zhàn)全攻略
- Learning Windows Server Containers
- SOA實(shí)踐者說(shuō)
- Ganglia系統(tǒng)監(jiān)控
- Ubuntu Linux操作系統(tǒng)
- 精解Windows8
- 注冊(cè)表應(yīng)用完全DIY
- RHCSARHCE 紅帽Linux認(rèn)證學(xué)習(xí)指南(第7版)EX200 & EX300
- Heroku Cloud Application Development
- Java EE 7 Developer Handbook
- Learn OpenShift
- Linux系統(tǒng)管理初學(xué)者指南:基于CentOS 7.6
- Less Web Development Essentials