overload init function in class/object ? [message #34990] |
Tue, 06 May 2003 12:29 |
paul wisehart
Messages: 28 Registered: December 2002
|
Junior Member |
|
|
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
;-----------------------
pro obj::cleanup
compile_opt idl2
end
;=======================
pro obj__define
compile_opt idl2
obj = { obj, $
d1: 0, $
d2: 0 }
end
;=======================
;--- obj__define.pro -------------------
--
paul \ /
wisehart >/
<//////$>
|\|\|\
|
|
|