Swift 2 面向对象编程PDF电子书下载
- 电子书积分:12 积分如何计算积分?
- 作 者:Gaston C.Hillar著
- 出 版 社:南京:东南大学出版社
- 出版年份:2017
- ISBN:9787564170790
- 页数:309 页
Chapter 1:Objects from the Real World to Playground 1
Installing the required software 1
Capturing objects from the real world 4
Generating classes to create objects 11
Recognizing variables and constants to create properties 14
Recognizing actions to create methods 17
organizing classes with UML diagrams 20
Working with API objects in the Xcode Playground 26
Exercises 31
Test your knowledge 31
Summary 32
Chapter 2:Structures,Classes,and Instances 33
Understanding structures,classes,and instances 33
Understanding initialization and its customization 34
Understanding deinitialization and its customization 36
Understanding automatic reference counting 36
Declaring classes 37
Customizing initialization 38
Customizing deinitialization 41
Creating the instances of classes 45
Exercises 46
Test your knowledge 46
Summary 47
Chapter 3:Encapsulation of Data with Properties 49
Understanding the elements that compose a class 49
Declaring stored properties 51
Generating computed properties with setters and getters 54
Combining setters,getters,and a related property 62
Understanding property observers 65
Transforming values with setters and getters 69
Using type properties to create values shared by all the instances of a class 70
Creating mutable classes 74
Building immutable classes 78
Exercises 81
Test your knowledge 81
Summary 82
Chapter 4:Inheritance,Abstraction,and Specialization 83
Creating class hierarchies to abstract and specialize behavior 83
Understanding inheritance 88
Declaring classes that inherit from another class 90
Overriding and overloading methods 96
Overriding properties 101
Controlling whether subclasses can or cannot override members 103
Working with typecasting and polymorphism 108
Taking advantage of operator overloading 121
Declaring operator functions for specific subclasses 126
Exercises 128
Test your knowledge 128
Summary 129
Chapter 5:Contract Programming with Protocols 131
Understanding how protocols work in combination with classes 131
Declaring protocols 133
Declaring classes that adopt protocols 137
Taking advantage of the multiple inheritance of protocols 142
Combining inheritance and protocols 144
Working with methods that receive protocols as arguments 152
Downcasting with protocols and classes 155
Treating instances of a protocol type as a different subclass 159
Specifying requirements for properties 162
Specifying requirements for methods 164
Combining class inheritance with protocol inheritance 166
Exercises 178
Test your knowledge 179
Summary 180
Chapter 6:Maximization of Code Reuse with Generic Code 181
Understanding parametric polymorphism and generic code 181
Declaring a protocol to be used as a constraint 183
Declaring a class that conforms to multiple protocols 184
Declaring subclasses that inherit the conformance to protocols 188
Declaring a class that works with a constrained generic type 190
Using a generic class for multiple types 195
Combining initializer requirements in protocols with generic types 201
Declaring associated types in protocols 202
Creating shortcuts with subscripts 204
Declaring a class that works with two constrained generic types 206
Using a generic class with two generic type parameters 209
Inheriting and adding associated types in protocols 213
Generalizing existing classes with generics 214
Extending base types to conform to custom protocols 223
Test your knowledge 225
Exercises 226
Summary 227
Chapter 7:Object-Oriented Programming and Functional Programming 229
Refactoring code to take advantage of object-oriented programming 229
Understanding functions as first-class citizens 241
Working with function types within classes 243
Creating a functional version of array filtering 245
Writing equivalent closures with simplified code 247
Creating a data repository with generics and protocols 248
Filtering arrays with complex conditions 253
Using map to transform values 256
Combining map with reduce 259
Chaining filter,map,and reduce 262
Solving algorithms with reduce 262
Exercises 264
Test your knowledge 265
Summary 266
Chapter 8:Extending and Building Object-Oriented Code 267
Putting together all the pieces of the object-oriented puzzle 267
Adding methods with extensions 269
Adding computed properties to a base type with extensions 273
Declaring new convenience initializers with extensions 278
Defining subscripts with extensions 280
Working with object-oriented code in apps 281
Adding an object-oriented data repository to a project 290
Interacting with an object-oriented data repository through Picker View 294
Exercises 299
Test your knowledge 299
Summary 300
Appendix:Exercise Answers 301
Chapter 1,Objects from the Real World to Playground 301
Chapter 2,Structures,Classes,and Instances 301
Chapter 3,Encapsulation of Data with Properties 302
Chapter 4,Inheritance,Abstraction,and Specialization 302
Chapter 5,Contract Programming with Protocols 302
Chapter 6,Maximization of Code Reuse with Generic Code 302
Chapter 7,Object-Oriented Programming and Functional Programming 303
Chapter 8,Extending and Building Object-Oriented Code 303
Index 305
- 《程序逻辑及C语言编程》卢卫中,杨丽芳主编 2019
- 《全国职业院校工业机器人技术专业规划教材 工业机器人现场编程》(中国)项万明 2019
- 《面向可持续发展的马克思主义经济科学研究》刘正刚,李晓,田军著 2018
- 《编程超有趣 奇妙Python轻松学 第1辑》HelloCode人工智能国际研究组 2018
- 《我的第一套编程启蒙绘本 看事件 开始了》编程猫教研团队编绘 2019
- 《STEM教育丛书 麦昆机器人和Micro:bit图形化编程》张弛责任编辑;(中国)陈宝杰,沙靓雯 2019
- 《面向工程教育的本科计算机类专业系列教材 普通高等教育“十一五”国家级规划教材 计算机网络 第3版》胡亮,徐高潮,魏晓辉,车喜龙编 2018
- 《ROS机器人编程与SLAM算法解析指南》陶满礼 2020
- 《我的第一套编程启蒙绘本 123 序列来啦》编程猫教研团队编绘 2019
- 《高等院校计算机任务驱动教改教材 C语言编程思维 第2版》(中国)陈萌,鲍淑娣 2019
- 《中风偏瘫 脑萎缩 痴呆 最新治疗原则与方法》孙作东著 2004
- 《水面舰艇编队作战运筹分析》谭安胜著 2009
- 《王蒙文集 新版 35 评点《红楼梦》 上》王蒙著 2020
- 《TED说话的力量 世界优秀演讲者的口才秘诀》(坦桑)阿卡什·P.卡里亚著 2019
- 《燕堂夜话》蒋忠和著 2019
- 《经久》静水边著 2019
- 《魔法销售台词》(美)埃尔默·惠勒著 2019
- 《微表情密码》(波)卡西亚·韦佐夫斯基,(波)帕特里克·韦佐夫斯基著 2019
- 《看书琐记与作文秘诀》鲁迅著 2019
- 《酒国》莫言著 2019