Re: Euphoria Object Oriented Programming

new topic     » goto parent     » topic index » view thread      » older message » newer message

Pete Lomax wrote:
> 
> PS regarding Matt not using new, shouldn't it always from the get-go (ie
> [pre] C++) have been x = Myclass.new(blah) anyway? <shrug>

I don't think so.  The 'new' keyword just tells the compiler to create the
object on the heap instead of the stack, and so must be explicitly freed.
The same constructor is called as if you simply did:

Myclass x(blah);

It's basically (to bastardize C and C++):

Myclass *x = malloc( sizeof(Myclass) );
x->Myclass(blah);

We don't really have this issue in Euphoria, since all of our memory 
management issues are taken care of for us (for normal Euphoria objects).
the closest equivalent would be a private variable inside a routine vs
a local or global variable that would hand around until you assigned 
something else to it and dereferenced the existing data.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu