LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class data access using OOP, style guidelines

Dear NI community!

Let me ask you about the following.
While using OOP, for accessing of data in the class (while creating some methods of this class) we can use either accessors (Data Members) (case 1), or simply Unbundle/Bundle functions (case 2). Could you, please, suggest, what will be the better style from the scalability point of view? When it's better to use accessors, and when - direct unbundle/bundle functions?

Thanks a lot in advance!

Case1.png

Case2.png

 

0 Kudos
Message 1 of 2
(2,610 Views)

Depends on the situation. In this specific case, where you're dealing with a reference, I wouldn't bother to rebundle at all, and probably an unbundle is fine because it's a reference to a specific item. However, if you think you might want to override the accessor in a child class later, then you should use an accessor. This would be more likely if you were returning data rather than a control reference.

Message 2 of 2
(2,597 Views)