comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » INIT functions... called when?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
INIT functions... called when? [message #19365] Tue, 07 March 2000 00:00
Steve Allison is currently offline  Steve Allison
Messages: 1
Registered: March 2000
Junior Member
Hi,

I'm just starting out with IDL and am having trouble creating objects, their
INIT methods don't seem to get called. Here a simple example of what I'm
doing:

<All in "TestClass.pro">

PRO TestClass1__define
struct = {TestClass1, number:0L}
END

FUNCTION TestClass1::init, arg
print, 'Initializing'
self.number = arg
RETURN,TRUE
END

PRO TestClass1::show
print, 'Number is', self.number
END

PRO TestClass1::set, arg
self.number = arg
END

Nothing staggering there... Anyway, I load this file into IDLDE, compile it
(it seems to compile without any complaints), and try to create objects
with:

IDL> p = OBJ_NEW('TestClass1',65)

Which in my book should set the field 'number' to 65. But...

IDL> p->show

gives:

Number is 0

So clearly INIT isn't being called (the message 'Initializing' doesn't show
either). I can change the value of 'number' using TestClass1::Set, and that
seems to work fine - it's just the INIT method I'm having trouble with. Why
isn't it being called? The documentation seems to say that it should be
called automatically when I call OBJ_NEW.

Thanks for your help...

Steve

--
Stephen Allison
sallison@netcomuk.co.uk
[Message index]
 
Read Message
Previous Topic: Re: INIT functions... called when?
Next Topic: IDL and Linux on dual processor

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:34:24 PDT 2025

Total time taken to generate the page: 1.12321 seconds