| Re: Method Overrides [message #80413 is a reply to message #80405] |
Mon, 04 June 2012 12:49  |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 6/4/12 1:20 PM, Matthew Argall wrote:
> Hi,
>
> I have a set of IDL objects and am running into method overriding
> problems at run-time. Any time I invoke a sub-class at run-time
> without explicitly compiling it before-hand, the class definition
> method gets compiled and executed, but not the over-riding methods.
> The super-class's methods still get used.
>
> All methods are in the same file before/above the object definition
> method (__define), so I thought they would be compiled and recognized
> at the same time, but apparently not as I expected.
This should work as you are expecting.
> At run-time, I see
> % Compiled module: CLASS__DEFINE
>
> But if I compile it myself
> IDL> .compile class__define
> % Compiled module: CLASS__DEFINE::METHOD1
> % Compiled module: CLASS__DEFINE::METHOD2
> % Compiled module: CLASS__DEFINE::METHOD3
> % Compiled module: CLASS__DEFINE
Are you using "compile_opt hidden" in the methods? Otherwise, I'm not
sure why this would be from what you are describing. Are you sure you
are getting the correct source code file, not an old one? Use "help,
/source" to see what has been compiled in your current IDL session.
> Could some one explain to me a little more clearly when or in which
> order to compile sub-classes and super-classes? Every time I use an
> over-riding method, do I either have to compile it or use the "obj ->
> classname::method" syntax to ensure that I get the right one?
You shouldn't ever have to manually compile things if you have named
them correctly. You also shouldn't have to use obj->classname::method
unless you are trying to get the superclasses' method.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
|
|
|
|