LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

OOP Override question

When I want a child class's VI to override the parent's VI, I right-click the child class and select "VI for Override". But you can also create a VI by selecting "VI from Dynamic Dispatch Template" and name it with the same name as the parent VI. This also accomplishes the override. Is there a difference between these two methods?  

0 Kudos
Message 1 of 6
(148 Views)

@ooth wrote:

Is there a difference between these two methods?  


No. If a VI has terminals set to be dynamic dispatch and a child class has a VI with the same name, that VI is expected to be an override VI (and if the relevant settings, like the connector pane, don't match, the VI will be broken).

 

You can create such a VI from scratch or modify an existing VI. The two methods you described simply do some of the work for you.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(132 Views)

OK good to know. Thanks for the quick reply.

0 Kudos
Message 3 of 6
(121 Views)

@ooth wrote:

When I want a child class's VI to override the parent's VI, I right-click the child class and select "VI for Override". But you can also create a VI by selecting "VI from Dynamic Dispatch Template" and name it with the same name as the parent VI. This also accomplishes the override. Is there a difference between these two methods?  


Using the "VI for Override" uses the parent's VI as the basic template instead of the default Dynamic Dispatch Template.  Using the VI for Override will save you steps as the required controls and indicators will already be there for you and properly connected to the Connector Pane.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(117 Views)

@crossrulz wrote:


Using the "VI for Override" uses the parent's VI as the basic template instead of the default Dynamic Dispatch Template.


Right, I was focused on the basics and forgot to talk about the actual differences between the two.


___________________
Try to take over the world!
0 Kudos
Message 5 of 6
(100 Views)

There are versions of LabVIEW where the "VI for Override" created a VI but didn't mark the .lvclass as changed.

 

The added VI was added to the class's cache though.

 

The result is everything looks dandy, even when reloading the project. Save all appears to save all, but doesn't save the .lvclass...

 

The problem showed only when you copy (or check out) the project (sometimes weeks later!). The cached class isn't there, the .lvclass is loaded from file, and that version doesn't have the override added to it. This (the override that's not in the class) goes unnoticed (e.g. no edit time error) and is a nasty thing to track.

 

If you explicitly save the class, everything's fine too.

 

You get weird conversations too (I fixed it, it's not fixed, it's fixed for me, it's not fixed for me, etc).

 

I think this was a problem in LV20, it got better but wasn't entirely fixed in LV23, maybe fixed in LV24 (didn't check), but I'm probably wrong and YMMV...

0 Kudos
Message 6 of 6
(39 Views)