Re: overload init function in class/object ? [message #34989 is a reply to message #34988] |
Tue, 06 May 2003 12:48  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
paul wisehart (wisehart@runbox.com) writes:
> I was under the assumption that you could overload the
> init function of an object.
>
> However, it doesn't work for me.
>
> In the below example I get an error if I try:
> IDL>o = obj_new('obj')
>
> Yet this works:
> IDL>o = obj_new('obj','test')
>
> I wanna be able to overload my init functions!
> Please tell me I'm doing something wrong.
>
>
> ;--- obj__define.pro -------------------
>
> function obj::init
> compile_opt idl2
> return, 1
> end
> ;-----------------------
> function obj::init, p1
> compile_opt idl2
> print, p1
> return, 1
> end
I think it is your definition of "overload" that
is probably doing you in. :-)
I'm not sure what you mean by it, but it sure doesn't
mean "define the same thing twice, in two different ways".
What exactly are you trying to do here?
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|