~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Documentation/gsdoc/NSObject.gsdoc

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?xml version="1.0"?>
2
 
<!DOCTYPE gsdoc PUBLIC "-//GNUstep//DTD gsdoc 0.6.6//EN" "http://www.gnustep.org/gsdoc-0_6_6.xml">
3
 
<gsdoc base="NSObject" prev="NSNumberFormatter" next="NSPipe" up="Base">
4
 
  <head>
5
 
    <title>NSObject</title>
6
 
    <author name="Richard Frith-Macdonald">
7
 
      <email address="rfm@gnu.org"/>
8
 
      <url url="http://www.gnustep.org/developers/whoiswho.html"/>
9
 
    </author>
10
 
    <author name="Nicola Pero">
11
 
      <email address="n.pero@mi.flashnet.it"/>
12
 
      <url url="http://www.gnustep.org/developers/whoiswho.html"/>
13
 
    </author>
14
 
    <version>$Revision: 1.13 $</version>
15
 
    <date>$Date: 2001/11/13 17:37:13 $</date>
16
 
  </head>
17
 
  <body>
18
 
    <chapter>
19
 
      <heading>NSObject</heading>
20
 
      <class name="NSObject">
21
 
        <declared>Foundation/NSObject.h</declared>
22
 
        <conform>NSObject</conform>
23
 
          <desc>
24
 
           <p>
25
 
             <code>NSObject</code> is the root class (a root class is
26
 
             a class with no superclass) of the gnustep base library
27
 
             class hierarchy, so all classes normally inherit from
28
 
             <code>NSObject</code>.  There is an exception though:
29
 
             <code>NSProxy</code> (which is used for remote messaging)
30
 
             does not inherit from <code>NSObject</code>.
31
 
           </p>
32
 
           <p>
33
 
             Unless you are really sure of what you are doing, all
34
 
             your own classes should inherit (directly or indirectly)
35
 
             from <code>NSObject</code> (or in special cases from
36
 
             <code>NSProxy</code>).  <code>NSObject</code> provides
37
 
             the basic common functionality shared by all gnustep
38
 
             classes and objects.
39
 
           </p>
40
 
           <p>
41
 
             The essential methods which must be implemented by all
42
 
             classes for their instances to be usable within gnustep
43
 
             are declared in a separate protocol, which is the
44
 
             <code>NSObject</code> protocol.  Both
45
 
             <code>NSObject</code> and <code>NSProxy</code> conform to
46
 
             this protocol, which means all objects in a gnustep
47
 
             application will conform to this protocol (btw, if you
48
 
             don't find a method of <code>NSObject</code> you are
49
 
             looking for in this documentation, make sure you also
50
 
             look into the documentation for the <code>NSObject</code>
51
 
             protocol).
52
 
           </p>
53
 
           <p>
54
 
             Theoretically, in special cases you might need to
55
 
             implement a new root class.  If you do, you need to make
56
 
             sure that your root class conforms (at least) to the
57
 
             <code>NSObject</code> protocol, otherwise it will not
58
 
             interact correctly with the gnustep framework.  Said
59
 
             that, I must note that I have never seen a case in which
60
 
             a new root class is needed.
61
 
           </p>
62
 
           <p>
63
 
             <code>NSObject</code> is a root class, which implies that
64
 
             instance methods of <code>NSObject</code> are treated in
65
 
             a special way by the Objective-C runtime.  This is an
66
 
             exception to the normal way messaging works with class
67
 
             and instance methods: if the Objective-C runtime can't
68
 
             find a class method for a class object, as a last resort
69
 
             it looks for an instance method of the root class with
70
 
             the same name, and executes it if it finds it.  This
71
 
             means that instance methods of the root class (such as
72
 
             <code>NSObject</code>) can be performed by class objects
73
 
             which inherit from that root class !  This can only
74
 
             happen if the class doesn't have a class method with the
75
 
             same name, otherwise that method - of course - takes the
76
 
             precedence.  Because of this exception,
77
 
             <code>NSObject</code>'s instance methods are written in
78
 
             such a way that they work both on <code>NSObject</code>'s
79
 
             instances and on class objects.
80
 
           </p>
81
 
          </desc>
82
 
        <method type="id" factory="yes">
83
 
          <sel>alloc</sel>
84
 
          <desc>
85
 
          Allocates a new instance of the receiver from the default
86
 
          zone, by invoking <code>allocWithZone:</code> with
87
 
          <code>NSDefaultMallocZone()</code> as the zone argument.
88
 
          Returns the created instance.
89
 
          </desc>
90
 
        </method>
91
 
        <method type="id" factory="yes">
92
 
          <sel>allocWithZone:</sel>
93
 
          <arg type="NSZone*">zone</arg>
94
 
          <desc>
95
 
          This is the basic method to create a new instance.  It
96
 
          allocates a new instance of the receiver from the specified
97
 
          memory zone.  
98
 
          <p>
99
 
            Memory for an instance of the receiver is allocated; a
100
 
            pointer to this newly created instance is returned.  All
101
 
            instance variables are set to 0 except the
102
 
            <code>isa</code> pointer which is set to point to the
103
 
            object class.  No initialization of the instance is
104
 
            performed: it is your responsibility to initialize the
105
 
            instance by calling an appropriate <code>init</code>
106
 
            method.  If you are not using the garbage collector, it is
107
 
            also your responsibility to make sure the returned
108
 
            instance is destroyed when you finish using it, by calling
109
 
            the <code>release</code> method to destroy the instance
110
 
            directly, or by using <code>autorelease</code> and
111
 
            autorelease pools.
112
 
          </p>
113
 
          <p>
114
 
           You do not normally need to override this method in
115
 
           subclasses, unless you are implementing a class which for
116
 
           some reasons silently allocates instances of another class
117
 
           (this is typically needed to implement class clusters and
118
 
           similar design schemes).
119
 
          </p>
120
 
          <p>
121
 
            If you have turned on debugging of object allocation (by
122
 
            calling the <code>GSDebugAllocationActive</code>
123
 
            function), this method will also update the various
124
 
            debugging counts and monitors of allocated objects, which
125
 
            you can access using the <code>GSDebugAllocation...</code>
126
 
            functions.
127
 
          </p>
128
 
          </desc>
129
 
        </method>
130
 
        <method type="void" factory="yes">
131
 
          <sel>cancelPreviousPerformRequestsWithTarget:</sel>
132
 
          <arg type="id">aTarget</arg>
133
 
          <sel>selector:</sel>
134
 
          <arg type="SEL">aSelector</arg>
135
 
          <desc>
136
 
          </desc>
137
 
        </method>
138
 
        <method type="Class" factory="yes">
139
 
          <sel>class</sel>
140
 
          <desc>
141
 
          Returns the receiver.
142
 
          </desc>
143
 
        </method>
144
 
        <method type="BOOL" factory="yes">
145
 
          <sel>conformsToProtocol:</sel>
146
 
          <arg type="Protocol*">aProtocol</arg>
147
 
          <desc>
148
 
          </desc>
149
 
        </method>
150
 
        <method type="id" factory="yes">
151
 
          <sel>copyWithZone:</sel>
152
 
          <arg type="NSZone*">zone</arg>
153
 
          <desc>
154
 
          </desc>
155
 
        </method>
156
 
        <method type="NSString*" factory="yes">
157
 
          <sel>description</sel>
158
 
          <desc>
159
 
            The <code>description</code> factory method describes the class
160
 
            of the receiver.  In the default GNUstep implementation, this
161
 
            simply returns the name of the class as an NSString object.
162
 
          </desc>
163
 
        </method>
164
 
        <method type="NSString*" factory="yes">
165
 
          <sel>descriptionWithLocale:</sel>
166
 
          <arg type="NSDictionary*">aLocale</arg>
167
 
          <desc>
168
 
            The default (NSOBject) implementation of this method simply calls
169
 
            the <code>description</code> method and discards the locale
170
 
            information.
171
 
          </desc>
172
 
          <standards><GNUstep/></standards>
173
 
        </method>
174
 
        <method type="NSString*" factory="yes">
175
 
          <sel>descriptionWithLocale:</sel>
176
 
          <arg type="NSDictionary*">aLocale</arg>
177
 
          <sel>indent:</sel>
178
 
          <arg type="unsigned int">level</arg>
179
 
          <desc>
180
 
            The default (NSObject) implementation of this method simply calls
181
 
            the <code>descriptionWithLocale:</code> method and discards the
182
 
            level information.
183
 
          </desc>
184
 
          <standards><GNUstep/></standards>
185
 
        </method>
186
 
        <method type="NSString*" factory="yes">
187
 
          <sel>descriptionWithLocale:</sel>
188
 
          <arg type="NSDictionary*">aLocale</arg>
189
 
          <sel>indent:</sel>
190
 
          <arg type="unsigned int">level</arg>
191
 
          <sel>to:</sel>
192
 
          <arg type="id&lt;GNUDescriptionDestination&gt;">output</arg>
193
 
          <desc>
194
 
            The default (NSObject) implementation of this method simply calls
195
 
            the <code>descriptionWithLocale:indent:</code> method and appends
196
 
            the value returned by that method to the output object.
197
 
          </desc>
198
 
          <standards><GNUstep/></standards>
199
 
        </method>
200
 
        <method type="void" factory="yes">
201
 
          <sel>initialize</sel>
202
 
          <desc>
203
 
          </desc>
204
 
        </method>
205
 
        <method type="IMP" factory="yes">
206
 
          <sel>instanceMethodForSelector:</sel>
207
 
          <arg type="SEL">aSelector</arg>
208
 
          <desc>
209
 
          </desc>
210
 
        </method>
211
 
        <method type="NSMethodSignature*" factory="yes">
212
 
          <sel>instanceMethodSignatureForSelector:</sel>
213
 
          <arg type="SEL">aSelector</arg>
214
 
          <desc>
215
 
            Returns a method signature object representing the
216
 
            method implemented for instsances of this class which
217
 
            corresponds to the supplied selector.
218
 
          </desc>
219
 
        </method>
220
 
        <method type="BOOL" factory="yes">
221
 
          <sel>instancesRespondToSelector:</sel>
222
 
          <arg type="SEL">aSelector</arg>
223
 
          <desc>
224
 
          </desc>
225
 
        </method>
226
 
        <method type="void" factory="yes">
227
 
          <sel>load</sel>
228
 
          <desc>
229
 
          </desc>
230
 
        </method>
231
 
        <method type="id" factory="yes">
232
 
          <sel>mutableCopyWithZone:</sel>
233
 
          <arg type="NSZone*">zone</arg>
234
 
          <desc>
235
 
          </desc>
236
 
        </method>
237
 
        <method type="id" factory="yes">
238
 
          <sel>new</sel>
239
 
          <desc>
240
 
          This method is a short-hand for alloc followed by init, that is,
241
 
           <p><code>
242
 
             NSObject *object = [NSObject new];
243
 
           </code></p>
244
 
          is exactly the same as 
245
 
           <p><code>
246
 
             NSObject *object = [[NSObject alloc] init];
247
 
           </code></p>
248
 
          <p>
249
 
            This is a general convention: all <code>new...</code>
250
 
            methods are supposed to return a newly allocated and
251
 
            initialized instance, as would be generated by an
252
 
            <code>alloc</code> method followed by a corresponding
253
 
            <code>init...</code> method.  Please note that if you are 
254
 
            not using a garbage collector, this means that instances 
255
 
            generated by the <code>new...</code> methods are not 
256
 
            autoreleased, that is, you are responsible for releasing 
257
 
            (autoreleasing) the instances yourself.  So when you use 
258
 
            <code>new</code> you typically do something like:
259
 
          </p>
260
 
          <p>
261
 
            <code>
262
 
               NSMutableArray *array = AUTORELEASE ([NSMutableArray new]);
263
 
            </code>
264
 
         </p>
265
 
          <p>
266
 
            You do no normally need to override <code>new</code> in
267
 
            subclasses, because if you override <code>init</code> (and
268
 
            optionally <code>allocWithZone:</code> if you really
269
 
            need), <code>new</code> will automatically use your
270
 
            subclass methods.
271
 
          </p>
272
 
          <p>
273
 
            You might need instead to define new <code>new...</code>
274
 
            methods specific to your subclass to match any
275
 
            <code>init...</code> specific to your subclass.  For
276
 
            example, if your subclass defines
277
 
          </p>
278
 
          <p>
279
 
            <code>-initWithName:</code>
280
 
          </p> 
281
 
          <p>
282
 
            it might be handy for you to have a 
283
 
          </p>
284
 
          <p>
285
 
             <code>+newWithName:</code>
286
 
          </p> 
287
 
          <p>
288
 
            which combines <code>alloc</code> and
289
 
            <code>initWithName:</code>.  You would implement it as follows:
290
 
          </p>
291
 
          <p>
292
 
            <code> 
293
 
              + (id) newWithName: (NSString *)aName 
294
 
                { 
295
 
                   return [[self alloc] initWithName: aName]; 
296
 
                } 
297
 
            </code>
298
 
          </p>
299
 
          </desc>
300
 
        </method>
301
 
        <method type="void" factory="yes">
302
 
          <sel>poseAsClass:</sel>
303
 
          <arg type="Class">aClass</arg>
304
 
          <desc>
305
 
          </desc>
306
 
        </method>
307
 
        <method type="void" factory="yes">
308
 
          <sel>setVersion:</sel>
309
 
          <arg type="int">aVersion</arg>
310
 
          <desc>
311
 
          </desc>
312
 
        </method>
313
 
        <method type="Class" factory="yes">
314
 
          <sel>superclass</sel>
315
 
          <desc>
316
 
          </desc>
317
 
        </method>
318
 
        <method type="int" factory="yes">
319
 
          <sel>version</sel>
320
 
          <desc>
321
 
          </desc>
322
 
        </method>
323
 
        <method type="id">
324
 
          <sel>awakeAfterUsingCoder:</sel>
325
 
          <arg type="NSCoder*">aDecoder</arg>
326
 
          <desc>
327
 
          </desc>
328
 
        </method>
329
 
        <method type="Class">
330
 
          <sel>classForArchiver</sel>
331
 
          <desc>
332
 
          </desc>
333
 
        </method>
334
 
        <method type="Class">
335
 
          <sel>classForCoder</sel>
336
 
          <desc>
337
 
          </desc>
338
 
        </method>
339
 
        <method type="Class">
340
 
          <sel>classForPortCoder</sel>
341
 
          <desc>
342
 
          </desc>
343
 
        </method>
344
 
        <method type="BOOL">
345
 
          <sel>connection:</sel>
346
 
          <arg type="NSConnection*">connection</arg>
347
 
          <sel>handleRequest:</sel>
348
 
          <arg type="NSDistantObjectRequest*">doreq</arg>
349
 
          <desc>
350
 
          </desc>
351
 
        </method>
352
 
        <method type="id">
353
 
          <sel>copy</sel>
354
 
          <desc>
355
 
          </desc>
356
 
        </method>
357
 
        <method type="void">
358
 
          <sel>dealloc</sel>
359
 
          <desc>
360
 
          <p>
361
 
            <code>NSObject</code>'s implementation of this method
362
 
            destroys the receiver, by returning the memory allocated
363
 
            to the receiver to the system.  After this method has been
364
 
            called on an instance, you must not refer the instance in
365
 
            any way, because it does not exist any longer.  If you do,
366
 
            it is a bug and your program might even crash with a
367
 
            segmentation fault.
368
 
          </p>
369
 
          <p>
370
 
            If you have turned on the debugging facilities for
371
 
            instance allocation, <code>NSObject</code>'s
372
 
            implementation of this method will also update the various
373
 
            counts and monitors of allocated instances (see the
374
 
            <code>GSDebugAllocation...</code> functions for more
375
 
            info).
376
 
          </p>
377
 
          <p>
378
 
            Normally you are supposed to manage the memory taken by
379
 
            objects by using the high level interface provided by the
380
 
            <code>retain</code>, <code>release</code> and
381
 
            <code>autorelease</code> methods (or better by the
382
 
            corresponding macros <code>RETAIN</code>,
383
 
            <code>RELEASE</code> and <code>AUTORELEASE</code>), and by
384
 
            autorelease pools and such; whenever the
385
 
            release/autorelease mechanism determines that an object is
386
 
            no longer needed (which happens when its retain count
387
 
            reaches 0), it will call the <code>dealloc</code> method
388
 
            to actually deallocate the object.  This means that normally, 
389
 
            you should not need to call <code>dealloc</code> directly as 
390
 
            the gnustep base library automatically calls it for you when 
391
 
            the retain count of an object reaches 0.
392
 
          </p>
393
 
          <p>
394
 
            Because the <code>dealloc</code> method will be called
395
 
            when an instance is being destroyed, if instances of your
396
 
            subclass use objects or resources (as it happens for most
397
 
            useful classes), you must override <code>dealloc</code> in
398
 
            subclasses to release all objects and resources which are
399
 
            used by the instance, otherwise these objects and
400
 
            resources would be leaked.  In the subclass
401
 
            implementation, you should first release all your subclass
402
 
            specific objects and resources, and then invoke super's
403
 
            implementation (which will do the same, and so on up in
404
 
            the class hierarchy to <code>NSObject</code>'s
405
 
            implementation, which finally destroys the object).  Here
406
 
            is an example of the implementation of
407
 
            <code>dealloc</code> for a subclass whose instances have a
408
 
            single instance variable <code>name</code> which needs to
409
 
            be released when an instance is deallocated:
410
 
          </p>
411
 
          <p>
412
 
            <code>
413
 
            - (void) dealloc
414
 
              {
415
 
                RELEASE (name);
416
 
                [super dealloc];
417
 
              }
418
 
            </code>
419
 
           </p>
420
 
           <p>
421
 
             <code>dealloc</code> might contain code to release not
422
 
             only objects, but also other resources, such as open
423
 
             files, network connections, raw memory allocated in other
424
 
             ways, etc.
425
 
           </p>
426
 
          </desc>
427
 
        </method>
428
 
        <method type="NSString*">
429
 
          <sel>description</sel>
430
 
          <desc>
431
 
            <p>
432
 
              The <code>description</code> method describes the reciever.
433
 
              In the default GNUstep implementation, this returns an NSString
434
 
              object giving the name of the class of the receiver and the
435
 
              hexadecimal representation of the recievers address enclosed
436
 
              in angle brackets.
437
 
            </p>
438
 
            <p>
439
 
              Generally, classes other than NSObject will override this method
440
 
              to provide a more informative description of their instances.
441
 
            </p>
442
 
          </desc>
443
 
        </method>
444
 
        <method type="NSString*">
445
 
          <sel>descriptionWithLocale:</sel>
446
 
          <arg type="NSDictionary*">aLocale</arg>
447
 
          <desc>
448
 
            The default (NSOBject) implementation of this method simply calls
449
 
            the <code>description</code> method and discards the locale
450
 
            information.
451
 
          </desc>
452
 
          <standards><GNUstep/></standards>
453
 
        </method>
454
 
        <method type="NSString*">
455
 
          <sel>descriptionWithLocale:</sel>
456
 
          <arg type="NSDictionary*">aLocale</arg>
457
 
          <sel>indent:</sel>
458
 
          <arg type="unsigned int">level</arg>
459
 
          <desc>
460
 
            The default (NSObject) implementation of this method simply calls
461
 
            the <code>descriptionWithLocale:</code> method and discards the
462
 
            level information.
463
 
          </desc>
464
 
          <standards><GNUstep/></standards>
465
 
        </method>
466
 
        <method type="NSString*">
467
 
          <sel>descriptionWithLocale:</sel>
468
 
          <arg type="NSDictionary*">aLocale</arg>
469
 
          <sel>indent:</sel>
470
 
          <arg type="unsigned int">level</arg>
471
 
          <sel>to:</sel>
472
 
          <arg type="id&lt;GNUDescriptionDestination&gt;">output</arg>
473
 
          <desc>
474
 
            The default (NSObject) implementation of this method simply calls
475
 
            the <code>descriptionWithLocale:indent:</code> method and appends
476
 
            the value returned by that method to the output object.
477
 
            <p>
478
 
              Property-list classes (NSString, NSArray, NSDictionary and
479
 
              NSData) will override this method in order to efficiently
480
 
              write descriptions of themselves into property lists.
481
 
            </p>
482
 
          </desc>
483
 
          <standards><GNUstep/></standards>
484
 
        </method>
485
 
        <method type="void">
486
 
          <sel>doesNotRecognizeSelector:</sel>
487
 
          <arg type="SEL">aSelector</arg>
488
 
          <desc>
489
 
          </desc>
490
 
        </method>
491
 
        <method type="void">
492
 
          <sel>forwardInvocation:</sel>
493
 
          <arg type="NSInvocation*">anInvocation</arg>
494
 
          <desc>
495
 
          </desc>
496
 
        </method>
497
 
        <method type="unsigned int">
498
 
          <sel>hash</sel>
499
 
          <desc>
500
 
          </desc>
501
 
        </method>
502
 
        <method type="id">
503
 
          <sel>init</sel>
504
 
          <desc>
505
 
          </desc>
506
 
        </method>
507
 
        <method type="BOOL">
508
 
          <sel>isEqual:</sel>
509
 
          <arg type="id">anObject</arg>
510
 
          <desc>
511
 
          </desc>
512
 
        </method>
513
 
        <method type="IMP">
514
 
          <sel>methodForSelector:</sel>
515
 
          <arg type="SEL">aSelector</arg>
516
 
          <desc>
517
 
          </desc>
518
 
        </method>
519
 
        <method type="NSMethodSignature*">
520
 
          <sel>methodSignatureForSelector:</sel>
521
 
          <arg type="SEL">aSelector</arg>
522
 
          <desc>
523
 
            Returns a method signature object representing the
524
 
            method implemented in this object which corresponds to
525
 
            the supplied selector.
526
 
          </desc>
527
 
        </method>
528
 
        <method type="id">
529
 
          <sel>mutableCopy</sel>
530
 
          <desc>
531
 
          </desc>
532
 
        </method>
533
 
        <method type="void">
534
 
          <sel>performSelector:</sel>
535
 
          <arg type="SEL">aSelector</arg>
536
 
          <sel>withObject:</sel>
537
 
          <arg type="id">anArgument</arg>
538
 
          <desc>
539
 
          </desc>
540
 
        </method>
541
 
        <method type="void">
542
 
          <sel>performSelector:</sel>
543
 
          <arg type="SEL">aSelector</arg>
544
 
          <sel>withObject:</sel>
545
 
          <arg type="id">anArgument</arg>
546
 
          <sel>afterDelay:</sel>
547
 
          <arg type="NSTimeInterval">delay</arg>
548
 
          <sel>inModes:</sel>
549
 
          <arg type="NSArray*">modes</arg>
550
 
          <desc>
551
 
          </desc>
552
 
        </method>
553
 
        <method type="id">
554
 
          <sel>replacementObjectForArchiver:</sel>
555
 
          <arg type="NSArchiver*">anArchiver</arg>
556
 
          <desc>
557
 
          </desc>
558
 
        </method>
559
 
        <method type="id">
560
 
          <sel>replacementObjectForCoder:</sel>
561
 
          <arg type="NSCoder*">aCoder</arg>
562
 
          <desc>
563
 
          </desc>
564
 
        </method>
565
 
        <method type="id">
566
 
          <sel>replacementObjectForPortCoder:</sel>
567
 
          <arg type="NSPortCoder*">aCoder</arg>
568
 
          <desc>
569
 
          </desc>
570
 
        </method>
571
 
        <method type="BOOL">
572
 
          <sel>deallocNotificationsActive</sel>
573
 
          <desc>
574
 
            <p>
575
 
              Returns a boolean indicating whether deallocation notification
576
 
              has been turned on.
577
 
            </p>
578
 
            <p>
579
 
              If deallocation notification is turned on, whenever an objects
580
 
              retain count reaches zero (and it would normally be deallocated)
581
 
              the <em>_dealloc</em> methiod is called and the object is only
582
 
              deallocated if that method returns YES.
583
 
            </p>
584
 
          </desc>
585
 
        </method>
586
 
        <method type="void">
587
 
          <sel>setDeallocNotificationsActive:</sel>
588
 
          <arg type="BOOL">flag</arg>
589
 
          <desc>
590
 
            <p>
591
 
              Turns on (or off) deallocation notification.
592
 
            </p>
593
 
            <p>
594
 
              If deallocation notification is turned on, whenever an objects
595
 
              retain count reaches zero (and it would normally be deallocated)
596
 
              the <em>_dealloc</em> methiod is called and the object is only
597
 
              deallocated if that method returns YES.
598
 
            </p>
599
 
          </desc>
600
 
        </method>
601
 
        <method type="BOOL">
602
 
          <sel>_dealloc</sel>
603
 
          <desc>
604
 
            <p>
605
 
              Returns a boolean indicating whether the receiver should be
606
 
              deallocated or not.  The default implementation returns YES.
607
 
            </p>
608
 
            <p>
609
 
              This method is called when an objects retain count reaches
610
 
              zero (if deallocation notifications are active).
611
 
            </p>
612
 
            <p>
613
 
              This method is provided so that you can take some sort of
614
 
              action when objects are deallocated ... normally you would
615
 
              override this method in your classes, but you could also
616
 
              override it in a category of NSObject - and perform some
617
 
              action whenever <em>any</em> object is deallocated.
618
 
            </p>
619
 
          </desc>
620
 
        </method>
621
 
      </class>
622
 
    </chapter>
623
 
  </body>
624
 
</gsdoc>