What Is Objective-C?

Objective-C is an object-oriented language: it supports hierarchies of substitutable types, message-passing between objects, and code reuse through inheritance. Objective-C adds these features to the familiar C programming language.

Because Objective-C is an extension of C, many properties of an Objective-C program depend on the underlying C development tools. Among these properties are:

  • The size of scalar variables such as integers and floating-point numbers

  • Allowed placement of scoped declarations

  • Implicit type conversion and promotion

  • Storage of string literals

  • Preprocessor macro expansion

  • Compiler warning levels

  • Code optimization

  • Include and link search paths

For more information about these topics, consult the documentation for your development platform and tools.

Objective-C differs from C++, another object-oriented extension of C, by deferring decisions until runtime that C++ would make at compile time. Objective-C is distinguished by the following key features:

  • Dynamic dispatch

  • Dynamic typing

  • Dynamic loading

Dynamic Dispatch

Object-oriented languages replace function calls with messages . The difference is that the same message may trigger different code at runtime, depending on the type of the message receiver. Objective-C decides dynamically—at runtime—what code will handle a message by searching the receiver’s class and parent classes. (The Objective-C runtime caches the search results for better performance.) By contrast, a C++ compiler constructs a dispatch table ...

Get Objective-C Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.