[Gambas-user] Question about objects in memory

Demosthenes Koptsis demosthenesk at ...626...
Wed Dec 8 20:54:16 CET 2010


i have no intension to do something.
Anyway i dont know how to use such an information.

i just wanted to know it to describe it in my book.

Now i am in the chapter of pointers and memory management.

Something else...

the "NEW" word in Gambas is like "new" word in C++?

in the book "Teach Yourself C++ in 21 Days" it says that "The return
value from new is a memory address" and this is assigned to a pointer.

for example
unsigned short int * pPointer;
pPointer = new unsigned short int;

The NEW word in Gambas plays the same role?

For example the
hButton = NEW Button(ME) AS "MyButton"

the hButton is a pointer to the memory for the object?

I am asking this to understand better the subject of pointers...

Thanks for your time!

On Wed, 2010-12-08 at 16:13 +0100, Benoît Minisini wrote:
> > hi,
> > 
> > in the next example, the output of PRINT is the datatype and the address
> > of memory where the object exists?
> > 
> > ' Gambas module file
> > 
> > PUBLIC SUB Main()
> > 
> > DIM aArray AS NEW String[]
> > 
> > PRINT aArray
> > 
> > END
> > 
> > --------
> > Output:
> > --------
> > (String[] 0x21ce4a0)
> 
> Yes. But do not rely on that to do weird things.
> 
> Regards,
> 

-- 
Regards,
Demosthenes





More information about the User mailing list