没有合适的资源?快使用搜索试试~ 我知道了~
The Objective-C Programming Language
5星 · 超过95%的资源 需积分: 10 94 下载量 156 浏览量
2009-08-25
16:49:04
上传
评论
收藏 1.41MB PDF 举报
温馨提示
试读
146页
Objective-C语言基础,iPhone和apple尚编程的必学知识
资源推荐
资源详情
资源评论
The Objective-C Programming Language
2006-05-23
Apple Computer, Inc.
© 2006 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 document. Apple retains
all intellectual property rights associated
with the technology described in this
document. This document 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, Bonjour, Cocoa, Mac,
and Mac OS are trademarks of Apple
Computer, Inc., registered in the United
States and other countries.
Objective-C is a registered trademark of
NeXT Software, Inc.
Java and all Java-based trademarks are
trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other
countries.
Simultaneously published in the United
States and Canada.
Even though Apple has review ed this document,
APPLE MAKES NO WARRANTY OR
REPRESENTATION, EITHER EXPRESS OR
IMPLIED, WITH RESPECT TO THIS
DOCUMENT, ITS QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS FOR A
PARTICULAR PURPOSE. AS A RESULT, THIS
DOCUMENT IS PROVIDED “AS IS,” AND
YOU, THE READER, 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 DOCUMENT, 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 t he 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.
Contents
Introduction
Introduction to The Objective-C Programming Language 9
Who Should Read This Document 9
Organization of This Document 10
Conventions 10
See Also 11
Chapter 1
Why Objective-C? 13
Chapter 2
Object-Oriented Programming 15
Interface and Implementation 15
The Object Model 18
The Messaging Metaphor 19
Classes 20
Mechanisms Of Abstraction 23
Inheritance 25
Dynamism 27
Structuring Programs 31
Outlet Connections 31
Aggregation and Decomposition 33
Models and Frameworks 34
Structuring the Programming Task 35
Collaboration 35
Organizing Object-Oriented Projects 36
Chapter 3
The Language 39
Objects 39
id 40
Dynamic Typing 40
Object Messaging 41
The Receiver’s Instance Variables 42
Polymorphism 42
Dynamic Binding 43
Classes 43
Inheritance 44
Class Types 47
3
2006-05-23 | © 2006 Apple Computer, Inc. All Rights Reserved.
Class Objects 48
Class Names in Source Code 53
Defining a Class 54
The Interface 54
The Implementation 57
How Messaging Works 61
Selectors 64
Hidden Arguments 67
Messages to self and super 67
Extending Classes 71
Categories—Adding Methods to Existing Classes 72
Protocols—Declaring Interfaces for Others to Implement 74
Enabling Static Behaviors 82
Static Typing 82
Getting a Method Address 85
Getting an Object Data Structure 85
Exception Handling and Thread Synchronization 86
Handling Exceptions 86
Synchronizing Thread Execution 88
Using C++ With Objective-C 89
Mixing Objective-C and C++ Language Features 90
C++ Lexical Ambiguities and Conflicts 92
Chapter 4
The Runtime System 95
Interacting with the Runtime System 95
Allocating, Initializing, and Deallocating Objects 96
Allocating and Initializing Objects 97
Object Ownership 103
Deallocation 104
Forwarding 105
Forwarding and Multiple Inheritance 107
Surrogate Objects 107
Forwarding and Inheritance 108
Dynamic Loading 109
Remote Messaging 109
Distributed Objects 110
Language Support 111
Type Encodings 115
Appendix A
Language Summary 119
Messages 119
Defined Types 119
Preprocessor Directives 120
Compiler Directives 120
4
2006-05-23 | © 2006 Apple Computer, Inc. All Rights Reserved.
CONTENTS
Classes 122
Categories 122
Formal Protocols 123
Method Declarations 123
Method Implementations 124
Naming Conventions 124
Appendix B
Grammar 127
External Declarations 128
Type Specifiers 131
Type Qualifiers 131
Primary Expressions 132
Exceptions and Synchronization 133
Document Revision History 135
Glossary 137
Index 141
5
2006-05-23 | © 2006 Apple Computer, Inc. All Rights Reserved.
CONTENTS
剩余145页未读,继续阅读
scorpio038
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页