Objective-C Basics

Objective-C is an object-oriented programming language.  You are already familiar with the basic concepts of OOP, but we need to go over some of the specifics for this language.

Objects
An object in Objective-C needs to be declared before use.  This would typically be done by creating a reference to the object.  For example, to create a reference to a Person object called student:

    Person *student;

We can also use dynamic typing and create generic objects on occasion.  The actual class of the object can then be determined at run-time.

    id myObject;

Messages
The messaging syntax is

    [receiver message];  // Using a method with no arguments

    [receiver message: argument]; // Using a method with one argument

    [receiver message: arg1 andArg: arg2];  // Using a method with more than one argument

You can see examples in the documentation.

Foundation Classes

There are many useful classes already defined for us in the Foundation Classes.  The root class is NSObject.