Perhaps you mean Objective-C; I don't think that the Java version of Cocoa works this way.

Charles Yeomans

On Apr 24, 2006, at 7:54 AM, Theodore H. Smith wrote:


Cocoa does it a bit like this:

Have an [alloc] method, and an [init] method.

alloc is like new.

init is like passing constructor parameters. It's as if the constructor is split up into it's two component parts.

You could do it just like this:

dim MyObj as Type

MyObj = new Thing


At a later point, just call an init function

What if you want to make more of them at a later point? In that case we can use the factory approach. Another approach however, might be to make the object itself a factory.

Class MyObj
  function MakeNew() as MyObj
    return new MyObj
  end function
End Class

This is cool, because it cuts down on the complexity of structuring stuff. It lowers the administrative costs but gives the same benefit, which is always a good thing :)

Subject:
From: Marc Van Olmen <[EMAIL PROTECTED]>
Date: Sun, 23 Apr 2006 13:05:10 -0400

Implementing (or faking) the ability to override the New operator
is essentially the point of Factory and other creation patterns.

Charles Yeomans

Not familiar with Factory, any URL's where i can find more info about
this, google gave me only none working URL's like (http://
www.realstruts.com/)

cheers,

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to