Re: Euphoria Object Oriented Programming
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jan 03, 2007
- 1086 views
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