LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Factory Pattern - Wrong Thinking

OK, here's a puzzlement.  Just playing with this, made a little demo.  I take a child class object and cast its parent object onto it.  I then use it to call a Dyno-Dispatch method to see what happens.  This method only has any functionality at the child level - methods 'above ' the child level are empty shells.

 

What puzzles me is this: double-clicking on the child method gives the 'Choose Implementation' dialog box.  It shows my child level method, yep yep, but its parent ("Stepper Controller Class" in this case) is grayed out.  The magic arrow glyph points to my child class' grandparent, "Motion Controller Class".  The Help tells me:

 

"The arrow glyph indicates the implementation that executes if the run-time data type on the wire is the same as the edit-time data type on the wire. Because a LabVIEW class wire can carry data of its own type or data of any child type, this glyph indicates that the implementation LabVIEW executes at run time will be at the glyph level or below in the class hierarchy.

 

LabVIEW lists all classes in the LabVIEW class hierarchy. If a class inherits the dynamic dispatch member VI from an ancestor class but does not have its own implementation, LabVIEW dims the class in the Select VI list."

 

Now, I verified that the child class method functions as expected.  All class methods 'above' the child are just empty shells.  So I know that the method actually run at run time is that of the child's.  But the magic glyph points to the grandparent class.  So does that mean that the compiler, at edit time, doesn't yet know which implementation to use, but 'figures it out' at run-time?  Am I overthinking this?  Still puzzled, paul

0 Kudos
Message 11 of 15
(420 Views)

@PaulOfElora wrote:

So does that mean that the compiler, at edit time, doesn't yet know which implementation to use, but 'figures it out' at run-time?  Am I overthinking this?


Yes and yes.


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 12 of 15
(416 Views)

You might want to give this article a good read.  Hopefully it will clear up some things.

LabVIEW Object-Oriented Programming: The Decisions Behind the Design 


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 13 of 15
(415 Views)

Thanks CrossRulz, I had seen this once but I need to re-re-read it maybe 14 times (think Bart Simpson at the blackboard😉)

0 Kudos
Message 14 of 15
(396 Views)

Well on my way to Right Thinking - you guys have pulled me out of the ditch once again (even the same ditch I got stuck in a couple of months ago!).  Things are working nicely now, gratefully, paul

Message 15 of 15
(375 Views)