[OGo-Developer] Re: [OGo-Users] Re: click-to-dial & Asterisk
Helge Hess
developer@opengroupware.org
Sun, 9 Dec 2007 23:29:16 +0100
On 09.12.2007, at 23:09, Sebastian Reitenbach wrote:
> I forgot to ask in the other mail. I added a [super dealloc] in the
> dealloc method in AsteriskDialer.m, but I have no [super init] in
> the init method of that class, is that ok? At least there are no
> warnings or error messages anymore.
You need to distinguish between
a) allocation (+alloc)
b) initialization (-init..)
c) deallocation (-dealloc)
Technically it might be OK not to call [super init] (depending on the
Foundation library in use), but its highly recommended. The usual
constructs looks like this:
- (id)init {
if ((self = [super init]) != nil) {
// here goes your object setup code
}
return self;
}
Note that -init can return *different* objects. Thats sometimes used
for caches which return a cached object and dealloc the newly created
instance. Its also used in class clusters. etc.
Helge
--
Helge Hess
http://www.helgehess.eu/