
86 9 Chapter 5: The Languages of Mac OS X: Objective-C
Class and Instance Objects
Creating New
Instances
In languages such as Objective-C and SOM (the System Object
Model), classes themselves can be run-time objects. As with
the other issues discussed in this chapter, this can be a matter
for esoteric speculation and argument; it also has practical im-
plications.
In C++, you create a new instance with the new function:
Triangle* myTriangle = new Triangle;
The instance's constructor method is called automatically.
In Objective-C, if you have declared a Triangle object, you cre-
ate a new instance by calling a method of the class ...