03-30-2020 07:06 AM
Hello guys,
I am working on a LV program that will have different classes for different parts of a program.
But some of the data from the classes should be available to other classes. I know this could be done with "read VI" (class A) and connect to "write VI" (class B). This is functional, but in my opinion it is not so neat.
I hope you can point me to a better solution. In my opinion the best solution would be to connect two classes into one VI, and then share data with boundle/unboundle function, but LabView doesn't allow boundle/unboundle two classes in one VI.
What are your solution guys?
Do I have to learn parent/child classes first?
Thanks in advance.
Solved! Go to Solution.
03-30-2020 07:29 AM
Hi Jakob,
Yes - data in a class is inherently private. Even if you are a child of another class, you can't read their data directly. You must use an accessor (Read VI, etc).
It might be possible to design your classes in a way that reduces the need for accessor use - if you are finding that you're always using Read and Write accessors to do anything, you might be able to find a better design. This kind of "problem" might suggest that you're storing the wrong data, or that your classes are very closely "coupled".
If you tell us more about your design, it might be I or someone else could suggest possible changes to reduce this coupling or dependence on another class' private data.
03-30-2020 07:50 AM
Hello cbutcher,
Yes, data flow and storage must be thoughtfully designed within classes. I agree with that.
I don't really have a problem with that, but I just wanted to know for a better solution.
Thank you for your answer.
BR, Jakob