Important: You should read Object-Oriented Programming with Objective-C and The Objective-C 2.0 Programming Language instead.
This chapter describes the Objective-C language and discusses the principles of object-oriented programming as they’re implemented in Objective-C. It covers all the features that the language adds to standard C and C++.
Because object-oriented programs postpone many decisions from compile time to runtime, object-oriented languages depend on a runtime system for executing the compiled code. The runtime system for the Objective-C language is discussed in “The Runtime System.” This chapter presents the language, but touches on important elements of the runtime system.
The Apple compilers are based on the compilers of the GNU Compiler Collection. Objective-C syntax is a superset of GNU C/C++ syntax, and the Objective-C compiler works for C, C++ and Objective-C source code. The compiler recognizes Objective-C source files by the filename extension .m, just as it recognizes files containing only standard C syntax by filename extension .c. Similarly, the compiler recognizes C++ files that use Objective-C by the extension .mm. Other issues when using Objective-C with C++ are covered in the section “Using C++ With Objective-C.”
Objects
Object Messaging
Classes
Defining a Class
How Messaging Works
Extending Classes
Enabling Static Behaviors
Exception Handling and Thread Synchronization
Using C++ With Objective-C
Last updated: 2008-06-09