02-06-2013 03:39 PM
I have a child class running on a parent wire. The parent class has a reference, and the child class has some additional references. I want to clean these up during shutdown. But, because it is a parent wire, I cannot call my child class's "destroy" method directly. Is the best way to handle this to have destroy.vi be dynamic dispatch, so it will call the child's destroy method via DD, and set "call parent method" to required? This way if the class is a child, it will dynamic dispatch the child's method, but force the programmer to also call the parent method? How have others handled this?
02-06-2013 03:52 PM
@for(imstuck) wrote:
Is the best way to handle this to have destroy.vi be dynamic dispatch...?
Yes. That's the whole point of DD.
Note that for cleaning up resources, the order of the cleanup might be important, so either write in such a way that it doesn't matter or document it so that the developer of the child class knows exactly when the parent destroy should be called.