Graphics Programs Reference
In-Depth Information
An instance of
Party
, like all objects, is a chunk of data stored in memory, and it stores
the values for its attributes in
instance variables
. So an instance of
Party
might have the
instance variables
name
,
date
, and
budget
.
A C structure is a chunk of memory, and an object is a chunk of memory. A C structure
has data members, each with a name and a type. Similarly, an object has instance vari-
ables, each with a name and a type.
But there is an important difference between a structure in C and a class in Objective-C: a
class has
methods
. A method is similar to a function: it has a name, a return type, and a
list of parameters that it expects. A method also has access to an object's instance vari-
ables. If you want an object to run the code in one of its methods, you send that object a
message
.