Objects, Classes, Methods, and Messages in Cocoa Programming

By: Aaron Hillegass Emailed: 1674 times Printed: 2152 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

All Cocoa programming is done using object-oriented techniques. This section very briefly reviews terms used in object-oriented programming. If you have not done any object-oriented programming before, I recommend that you read The Objective-C Language. The PDF file for the book is on the Apple Web site (http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf).

What is an object? An object is like a C struct: It takes up memory and has variables inside it. The variables in an object are called instance variables. So when dealing with objects, the first questions we typically ask are: How do you allocate space for one? What instance variables does the object have? How do you destroy the object when you are done with it?

Some of the instance variables of an object will be pointers to other objects. These pointers enable one object to "know about" another object.

Classes are structures that can create objects. Classes specify the variables that the object has and are responsible for allocating memory for the object. We say that the object is an instance of the class that created it.

An object is better than a struct, because an object can have functions associated with it. We call the functions methods. To call a method, you send the object a message.


Cocoa Home | All Cocoa Tutorials | Latest Cocoa Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Aaron Hillegass
Printing in Mac Cocoa Programming
Web Services in Mac Cocoa Programming
Weak References in Mac Cocoa Programming
Garbage Collector in Cocoa Programming in Mac
Using NSOpenGLView in Cocoa Programming in Mac
Multithreading versus Multiprocessing in Mac OS X.
Life Cycle of a Cocoa Application
Frameworks in Cocoa Programming
Objects, Classes, Methods, and Messages in Cocoa Programming
Programming Language used in Cocoa Programming
What is Cocoa? A brief history of Cocoa.
Tools for Cocoa Programming

More Tutorials in Cocoa
Listing of files in a tar file in Mac OS X.
Listing of files in a zip file in Mac OS X.
Multithreading versus Multiprocessing in Mac OS X.
Using NSOpenGLView in Cocoa Programming in Mac
Garbage Collector in Cocoa Programming in Mac
Weak References in Mac Cocoa Programming
Web Services in Mac Cocoa Programming
Printing in Mac Cocoa Programming
Tools for Cocoa Programming
What is Cocoa? A brief history of Cocoa.
Programming Language used in Cocoa Programming
Objects, Classes, Methods, and Messages in Cocoa Programming
Frameworks in Cocoa Programming
Life Cycle of a Cocoa Application

More Latest News
Most Viewed Articles (in Cocoa )
Printing in Mac Cocoa Programming
Objects, Classes, Methods, and Messages in Cocoa Programming
Life Cycle of a Cocoa Application
Multithreading versus Multiprocessing in Mac OS X.
Tools for Cocoa Programming
What is Cocoa? A brief history of Cocoa.
Programming Language used in Cocoa Programming
Frameworks in Cocoa Programming
Listing of files in a tar file in Mac OS X.
Listing of files in a zip file in Mac OS X.
Using NSOpenGLView in Cocoa Programming in Mac
Garbage Collector in Cocoa Programming in Mac
Weak References in Mac Cocoa Programming
Web Services in Mac Cocoa Programming
Most Emailed Articles (in Cocoa)
Life Cycle of a Cocoa Application
What is Cocoa? A brief history of Cocoa.
Programming Language used in Cocoa Programming
Objects, Classes, Methods, and Messages in Cocoa Programming
Listing of files in a tar file in Mac OS X.
Listing of files in a zip file in Mac OS X.
Printing in Mac Cocoa Programming
Tools for Cocoa Programming
Multithreading versus Multiprocessing in Mac OS X.
Weak References in Mac Cocoa Programming
Web Services in Mac Cocoa Programming
Using NSOpenGLView in Cocoa Programming in Mac
Garbage Collector in Cocoa Programming in Mac
Frameworks in Cocoa Programming