没有合适的资源?快使用搜索试试~ 我知道了~
首页The Objective-C Programming Language.pdf
The Objective-C Programming Language.pdf
5星 · 超过95%的资源 需积分: 9 17 下载量 84 浏览量
更新于2023-03-03
评论 1
收藏 1.72MB PDF 举报
经典的《The Objective-C Programming Language》和《The C Programming Language》《The C++ Programming Language》一个系列的,Objective-C是纯C的相对于C++的另一个分支
资源详情
资源评论
资源推荐
Inside Mac OS X
The Objective-C Programming
Language
May 2002
Apple Computer, Inc.
© 2002 Apple Computer, Inc.
All rights reserved.
No part of this publication may be
reproduced, stored in a retrieval
system, or transmitted, in any form or
by any means, mechanical, electronic,
photocopying, recording, or
otherwise, without prior written
permission of Apple Computer, Inc.,
with the following exceptions: Any
person is hereby authorized to store
documentation on a single computer
for personal use only and to print
copies of documentation for personal
use provided that the documentation
contains Apple’s copyright notice.
The Apple logo is a trademark of
Apple Computer, Inc.
Use of the “keyboard” Apple logo
(Option-Shift-K) for commercial
purposes without the prior written
consent of Apple may constitute
trademark infringement and unfair
competition in violation of federal
and state laws.
No licenses, express or implied, are
granted with respect to any of the
technology described in this book.
Apple retains all intellectual property
rights associated with the technology
described in this book. This book is
intended to assist application
developers to develop applications
only for Apple-labeled or
Apple-licensed computers.
Every effort has been made to ensure
that the information in this document
is accurate. Apple is not responsible
for typographical errors.
Apple Computer, Inc.
1 Infinite Loop
Cupertino, CA 95014
408-996-1010
Apple, the Apple logo, and
Macintosh are trademarks of Apple
Computer, Inc., registered in the
United States and other countries.
HotSpot is a trademark of Sun
Microsystems, Inc.
Simultaneously published in the
United States and Canada.
Even though Apple has reviewed this
manual, APPLE MAKES NO
WARRANTY OR REPRESENTATION,
EITHER EXPRESS OR IMPLIED, WITH
RESPECT TO THIS MANUAL, ITS
QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS
FOR A PARTICULAR PURPOSE. AS A
RESULT, THIS MANUAL IS SOLD “AS
IS,” AND YOU, THE PURCHASER, ARE
ASSUMING THE ENTIRE RISK AS TO
ITS QUALITY AND ACCURACY.
IN NO EVENT WILL APPLE BE LIABLE
FOR DIRECT, INDIRECT, SPECIAL,
INCIDENTAL, OR CONSEQUENTIAL
DAMAGES RESULTING FROM ANY
DEFECT OR INACCURACY IN THIS
MANUAL, even if advised of the
possibility of such damages.
THE WARRANTY AND REMEDIES SET
FORTH ABOVE ARE EXCLUSIVE AND
IN LIEU OF ALL OTHERS, ORAL OR
WRITTEN, EXPRESS OR IMPLIED. No
Apple dealer, agent, or employee is
authorized to make any modification,
extension, or addition to this warranty.
Some states do not allow the exclusion or
limitation of implied warranties or
liability for incidental or consequential
damages, so the above limitation or
exclusion may not apply to you. This
warranty gives you specific legal rights,
and you may also have other rights which
vary from state to state.
3
Apple Computer, Inc. May 2002
Contents
Figures, Listings, and Tables
11
Chapter 1
Introduction
13
The Development Environment 14
Why Objective-C 15
How This Book is Organized 16
Conventions 17
Chapter 2
Object-Oriented Programming
19
Interface and Implementation 20
The Object Model 24
The Messaging Metaphor 26
Classes 28
Modularity 29
Reusability 30
Mechanisms Of Abstraction 31
Encapsulation 32
Polymorphism 33
Inheritance 35
Class Hierarchies 35
Subclass Definitions 36
Uses of Inheritance 37
Dynamism 39
Dynamic Typing 39
Dynamic Binding 40
Dynamic Loading 43
Structuring Programs 44
Outlet Connections 45
Extrinsic and Intrinsic Connections 47
4
Apple Computer, Inc. May 2002
CONTENTS
Activating the Object Network 47
Aggregation and Decomposition 48
Models and Frameworks 49
Structuring the Programming Task 50
Collaboration 51
Organizing Object-Oriented Projects 52
Designing on a Large Scale 52
Separating the Interface from the Implementation 52
Modularizing the Work 52
Keeping the Interface Simple 53
Making Decisions Dynamically 53
Inheriting Generic Code 53
Reusing Tested Code 54
Chapter 3
The Objective-C Language
55
Objective-C Objects 55
id 56
Dynamic Typing 57
Object Messaging 58
The Receiver’s Instance Variables 59
Polymorphism 60
Dynamic Binding 60
Classes 62
Inheritance 62
The NSObject Class 64
Inheriting Instance Variables 64
Inheriting Methods 65
Overriding One Method With Another 66
Abstract Classes 66
Class Types 67
Static Typing 67
Type Introspection 68
Class Objects 69
Creating Instances 70
Customization With Class Objects 71
Variables and Class Objects 72
CONTENTS
5
Apple Computer, Inc. May 2002
Initializing a Class Object 73
Methods of the Root Class 74
Class Names in Source Code 74
Defining a Class 75
The Interface 76
Importing the Interface 78
Referring to Other Classes 79
The Role of the Interface 79
The Implementation 80
Referring to Instance Variables 82
The Scope of Instance Variables 83
How Messaging Works 87
Selectors 90
Methods and Selectors 91
Method Return and Argument Types 91
Varying the Message at Runtime 92
The Target-Action Paradigm 92
Avoiding Messaging Errors 94
Hidden Arguments 95
Messages to self and super 95
An Example 97
Using super 99
Redefining self 100
Extending Classes 101
Categories—Adding Methods to Existing Classes 101
Adding to a Class 102
How Categories Are Used 103
Categories of the Root Class 104
Protocols—Declaring Interfaces for Others to Implement 104
When to Use Protocols 105
Enabling Static Behaviors 115
Static Typing 116
Type Checking 117
Return and Argument Types 118
Static Typing to an Inherited Class 119
Getting a Method Address 120
Getting an Object Data Structure 121
Using C++ With Objective-C 122
剩余225页未读,继续阅读
Ultramanhu
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2023年中国辣条食品行业创新及消费需求洞察报告.pptx
- 2023年半导体行业20强品牌.pptx
- 2023年全球电力行业评论.pptx
- 2023年全球网络安全现状-劳动力资源和网络运营的全球发展新态势.pptx
- 毕业设计-基于单片机的液体密度检测系统设计.doc
- 家用清扫机器人设计.doc
- 基于VB+数据库SQL的教师信息管理系统设计与实现 计算机专业设计范文模板参考资料.pdf
- 官塘驿林场林防火(资源监管)“空天地人”四位一体监测系统方案.doc
- 基于专利语义表征的技术预见方法及其应用.docx
- 浅谈电子商务的现状及发展趋势学习总结.doc
- 基于单片机的智能仓库温湿度控制系统 (2).pdf
- 基于SSM框架知识产权管理系统 (2).pdf
- 9年终工作总结新年计划PPT模板.pptx
- Hytera海能达CH04L01 说明书.pdf
- 数据中心运维操作标准及流程.pdf
- 报告模板 -成本分析与报告培训之三.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1