Cours the objective-c programming language

Sommaire: Cours the objective-c programming language

Introduction Introduction to The Objective-C Programming Language
Who Should Read This Document
Organization of This Document
Conventions
See Also
Runtime
Memory Management
Chapter Objects, Classes, and Messaging
Runtime
Objects
Object Basics
id
Dynamic Typing
Memory Management
Object Messaging
Message Syntax
Sending Messages to nil
The Receiver’ s Instance Variables
Polymorphism
Dynamic Binding
Dynamic Method Resolution
Dot Syntax
Classes
Inheritance
Class Types
Class Objects
Class Names in Source Code
Testing Class Equality
Chapter Defining a Class
Source Files
Class Interface
Importing the Interface
Referring to Other Classes
The Role of the Interface
Class Implementation
Referring to Instance Variables
The Scope of Instance Variables
Messages to self and super
An Example
Using super
Redefining self
Chapter Allocating and Initializing Objects
Allocating and Initializing Objects
The Returned Object
Implementing an Initializer
Constraints and Conventions
Handling Initialization Failure
Coordinating Classes
The Designated Initializer
Combining Allocation and Initialization
Chapter Protocols
Declaring Interfaces for Others to Implement
Methods for Others to Implement
Declaring Interfaces for Anonymous Objects
Non-Hierarchical Similarities
Formal Protocols
Declaring a Protocol
Optional Protocol Methods
Informal Protocols
Protocol Objects
Adopting a Protocol
Conforming to a Protocol
Type Checking
Protocols Within Protocols
Referring to Other Protocols
Chapter Declared Properties
Overview
Property Declaration and Implementation
Property Declaration
Property Declaration Attributes
Property Implementation Directives
Using Properties
Supported Types
Property Re-declaration
Copy
dealloc
Core Foundation
Example
Subclassing with Properties
Performance and Threading
Runtime Difference
Chapter Categories and Extensions
Adding Methods to Classes
How you Use Categories
Categories of the Root Class
Extensions
Chapter Associative References
Adding Storage Outside a Class Definition
Creating Associations
Retrieving Associated Objects
Breaking Associations
Complete Example
Chapter Fast Enumeration
The for…in Feature
Adopting Fast Enumeration
Using Fast Enumeration
Chapter Enabling Static Behavior
Default Dynamic Behavior
Static Typing
Type Checking
Return and Argument Types
Static Typing to an Inherited Class
Chapter Selectors
Methods and Selectors
SEL and @selector
Methods and Selectors
Method Return and Argument Types
Varying the Message at Runtime
The Target-Action Design Pattern
Avoiding Messaging Errors
Chapter Exception Handling
Enabling Exception-Handling
Exception Handling
Catching Different Types of Exception
Throwing Exceptions
Chapter Threading
Synchronizing Thread Execution
Chapter Remote Messaging
Distributed Objects
Language Support
Synchronous and Asynchronous Messages
Pointer Arguments
Proxies and Copies
Chapter Using C++ With Objective-C
Mixing Objective-C and C++ Language Features
C++ Lexical Ambiguities and Conflicts
Limitations
Appendix A Language Summary
Messages
Defined Types
Preprocessor Directives
Compiler Directives
Classes
Categories
Formal Protocols
Method Declarations
Method Implementations
Deprecation Syntax
Naming Conventions
Document Revision History
Glossary
Index

Extrait du cours the objective-c programming language

Introduction to The Objective-C Programming Language
The Objective-C language is a simple computer language designed to enable sophisticated object-oriented programming. Objective-C is defined as a small but powerful set of extensions to the standard ANSI C language. Its additions to C are mostly based on Smalltalk, one of the first object-oriented programming languages. Objective-C is designed to give C full object-oriented programming capabilities, and to do so in a simple and straightforward way.
Most object-oriented development environments consist of several parts:
■ An object-oriented programming language
■ A library of objects
■ A suite of development tools
■ A runtime environment
This document is about the first component of the development environment—the programming language.
It fully describes the Objective-C language, and provides a foundation for learning about the second component, the Mac OS X Objective-C application frameworks—collectively known as Cocoa. Y ou can start to learn more about Cocoa by reading Getting Started with Cocoa. The two main development tools you use are Xcode and Interface Builder , described in Xcode Workspace Guide and Interface Builder respectively. The runtime environment is described in a separate document, Objective-C Runtime Programming Guide.
Who Should Read This Document
The document is intended for readers who might be interested in:
■ Programming in Objective-C
■ Finding out about the basis for the Cocoa application framework
This document both introduces the object-oriented model that Objective-C is based upon and fully documents the language. It concentrates on the Objective-C extensions to C, not on the C language itself .
Because this isn ’t a document about C, it assumes some prior acquaintance with that language. However , it doesn’t have to be an extensive acquaintance. Object-oriented programming in Objective-C is sufficiently different from procedural programming in ANSI C that you won’t be hampered if you’ re not an experienced C programmer.
Objects, Classes, and Messaging
This chapter describes the fundamentals of objects, classes, and messaging as used and implemented by the Objective-C language. It also introduces the Objective-C runtime.
Runtime
The Objective-C language defers as many decisions as it can from compile time and link time to runtime.
Whenever possible, it dynamically performs operations such as creating objects and determining what method to invoke. This means that the language requires not just a compiler , but also a runtime system to execute the compiled code. The runtime system acts as a kind of operating system for the Objective-C language; it’ s what makes the language work. Typically , however , you don’t need to interact with the runtime directly . T o understand more about the functionality it offers, though, see Objective-C Runtime Programming Guide.
Objects
As the name implies, object-oriented programs are built around objects. An object associates data with the particular operations that can use or affect that data. Objective-C provides a data type to identify an object variable without specifying a particular class of the object—this allows for dynamic typing.
Object Basics
An object associates data with the particular operations that can use or affect that data. In Objective-C, these operations are known as the object’ s methods; the data they affect are its instance variables (in other environments they may be referred to as ivars or member variables). In essence, an object bundles a data structure (instance variables) and a group of procedures (methods) into a self-contained programming unit.
In Objective-C, an object’ s instance variables are internal to the object; generally , you get access to an object’ s state only through the object’ s methods (you can specify whether subclasses or other objects can access instance variables directly by using scope directives, see “The Scope of Instance Variables” (page 40)). For others to find out something about an object, there has to be a method to supply the information. For example, a Rectangle would have methods that reveal its size and its position. Moreover , an object sees only the methods that were designed for it; it can’t mistakenly perform methods intended for other types of objects. Just as a C function protects its local variables, hiding them from the rest of the program, an object hides both its instance variables and its method implementations.

……..

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Cours the objective-c programming language (1273 KO) (Cours PDF)
The objective-c programming language

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *