[OGo-Developer] Re: [OGo-Users] Re: click-to-dial & Asterisk

Sebastian Reitenbach developer@opengroupware.org
Sun, 09 Dec 2007 23:37:53 +0100


developer@opengroupware.org wrote: 
> 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;
> }
ok, up to this point, everything is fine, I'll add that too.

> 
> 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.
damn, and now I'm confused again, do you have any class or sth, in ogo, 
where this happens?

Sebastian