LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does 'LabVIEW Class:All Methods Of LVClass' return the ancestor class names for Dynamic Dispatch VIs and not the specified class method names?

Solved!
Go to solution

Suppose I have the following classes.

 

Class A:

Method 1 (dynamic dispatch)

Method 2 (dynamic dispatch)

Method 3 (static dispatch)

 

Class B: inherits from Class A

Method 1 (dynamic dispatch)

Method 2 (dynamic dispatch)

Method X (static dispatch)

 

When invoking the LabVIEW Class:All Methods Of LVClass, it returns fully qualified names of the Class A methods which have been overridden by Class B methods. Shouldn't it return the methods for the class specified and not its ancestor?

 

I can understand this behaviour for methods which don't have an override, i.e. Method 3., but not for ones which override it in the specified class.

 

Is this a bug? Are there any other methods that allow you to obtain all of the public methods of the child class at run-time?

 

LabVIEW_ayiOvRL968.png

Actual output:

Reoq08rqby.png

 

Expected output:

Expected outputExpected output

 

 



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 1 of 5
(2,432 Views)
Solution
Accepted by topic author matt.baker

I'm pretty sure that this isn't a bug. Your class B isn't used as object, but as class.

I recall that dynamic dispatching is a pure runtime behavior. That means that a class will always check the parental class(es) for methods before looking into its own methods. As a result, the All Methods of LVClass will return methods from ancestor down to children without checking for dynamic dispatch overrides....

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 5
(2,424 Views)

@Norbert_B wrote:

I'm pretty sure that this isn't a bug. Your class B isn't used as object, but as class.

I recall that dynamic dispatching is a pure runtime behavior. That means that a class will always check the parental class(es) for methods before looking into its own methods. As a result, the All Methods of LVClass will return methods from ancestor down to children without checking for dynamic dispatch overrides....


Bugger 😞



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 3 of 5
(2,421 Views)
Solution
Accepted by topic author matt.baker

Regarding your question on how to get a list of all methods of one specific class in your inheritance hierachy, i would check the property nodes "StaticMemberVIs" and "DynamicMemberVIs" you can find using the LVClassLibrary reference. This is more work (getting references, query names, ...) but should result in what you are looking for...

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 5
(2,419 Views)

Thanks Norbert. I use these in a related function, but they are not run-time. However, at the moment the function that uses the list of methods doesn't need to be included in the executable, so this will suffice for now.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 5 of 5
(2,378 Views)