Re: 'object' in IDL terminalogy [message #55964] |
Sun, 23 September 2007 13:18 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
kerber_80@yahoo.com writes:
> i'm little confused by IDL terminalogy. objects are created by OBJ_NEW
> function
>
> myObject = OBJ_NEW('ClassName')
>
> Does ClassName - object or class ???
> myObject is reference to ...what ???
OBJ_NEW creates a specific "instance" of an object
of a particular class. An object class or classname
refers to a general class of things (e.g., dogs).
The specific instance of the object class is something
particular (e.g., Echo or Prairie, both Golden Retrievers
who study IDL at the foot of David).
> And question without object programming
> i have two variables
>
> A = 10
> B = PTR_NEW(10)
>
> where are A and B stored ?
A and B are both local variables, stored at the level of
the program modules where they are defined.
> value '10' for B variable in heap (heap PC
> or heap IDL VM ???) how about A variable ?
The variable B, however, points to a global memory
location where the number 10 is stored, as opposed
to A, which points to a local memory location where
a different number 10 is stored. If you delete the
variables A and B, perhaps by exiting the program
module where they are created, IDL can reuse the
location where A stored its data, but the location
where B stored its data is now full and inaccessible
to you. This is called "leaking memory".
You might be interested in the Pointer Tutorial:
http://www.dfanning.com/misc_tips/pointers.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|