Re: Object Oriented programming question [message #15163 is a reply to message #15080] |
Fri, 23 April 1999 00:00   |
Michael Werger
Messages: 34 Registered: May 1997
|
Member |
|
|
Jean-Francois Lavoie wrote:
>
> Hi, I'm new to IDL and I'm looking forward using Object Oriented programming
> under IDL. As far as I can see, IDL doesn't support internal method calling
> inside a class, am I right ? I mean, within class A, suppose we have method
> A::Init and then A::SetValue, how can (or is it simply possible) to call the
> A::SetValue method from A::Init ? I didn't find any way to do this yet..
> Can someone help ? Thanks,
>
> Jean-Francois Lavoie
>
> Trainee - Industrial Vision and 3D Sensors
> INO - National Optics Institute
> 369 Franquet Street
> Sainte-Foy, Quebec
> CANADA G1P 4N8
>
Oh that's pretty simple (sorry I shouldn't say this ;-) - a good
way to see how is the file lib/trackball__define.pro
at definition of an object like trackball, the ::init method
is called which may be defined in such a way that you can specify
required and optional parameters - remember that you set the
object using self.(whatever...)
it is a very good (and probably the only) way to have all object
related methods in one file like the above examples trackball_define.pro
follow stricktly the order:
a) first arbitrary methods specialized for this object only
b) typical, more general methods (SetProperty, GetPro....
c) the init method
d) finally, the define method
IDL does then the rest - if you need another example like
creating a complete atom by a set of objects starting from
simple spheres, mail me (only an example, not fully done)
Cheers,
--
Michael Werger ------------o
ESA ESTEC & Praesepe B.V. |
Astrophysics Division mwerger@astro.estec.esa.nl|
| Postbus 299 http://astro.estec.esa.nl |
| 2200 AG Noordwijk +31 71 565 3783 (Voice)
o------------------- The Netherlands +31 71 565 4690 (FAX)
|
|
|