Objective-C

From Mac Guides

Jump to: navigation, search

Objective-C is an object oriented programming language that is an extension to C. It is used primarily on Mac OS X with the Cocoa framework, and is used by a significant number of Macintosh developers.

History

Objective-C was the primary language used in NeXTSTEP, and now plays a similar role in Mac OS X due to Mac OS X's heritage.

Syntax

Most of Objective-C's syntax is the same as that of C. One significant difference is the addition of messages. Messages are similar to function calls, in that instead of calling a method, you send a message. The syntax for sending a typical message would look like this:

[anObject doSomething];

This line of code sends the message "doSomething" to the "anObject" object. If anObject has a method called doSomething, it will then be executed.

See Also