help-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alloc/dealloc etiquette


From: Michael Hopkins
Subject: Alloc/dealloc etiquette
Date: Sat, 17 Feb 2007 00:36:14 +0000
User-agent: Microsoft-Entourage/11.3.3.061214


Hi all

I am writing some Obj-C classes and, looking at various examples, (e.g.
Learning Cocoa with Objective-C, chapter 3) it seems that some objects do
not need to implement +alloc.  My previous understanding was that you needed
to implement +alloc, -init & -dealloc for all classes - or at least that it
was highly advisable.

I guess if you don't implement +alloc then the message gets sent up to the
superclass (usually NSObject in our case).  If someone could enlighten me
here on the practical implications of these choices and best practice (for
instance, does it make a difference if your class contains instance
variables and whether they are heap allocated or not) then that would be
very helpful.

Thanks in advance

Michael


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

        _/    _/   _/_/_/             Hopkins Research Ltd
       _/    _/   _/    _/
      _/_/_/_/   _/_/_/          http://www.hopkins-research.com/
     _/    _/   _/   _/
    _/    _/   _/     _/               'touch the future'
                   
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]