twols Posted December 14, 2012 Report Share Posted December 14, 2012 Hello! Is it possible (or how?) to have so persistent data over all objects inheriting from one generic class? I do have a class called "GenericView" and this class contains a list of localization strings. I would like to interit from this class in all classes which have some UI outputs. But I want do fill those language string just one time at startup. In PHP or Java i would declare a static variable for a localization class... Quote Link to comment
mje Posted December 14, 2012 Report Share Posted December 14, 2012 You do this in LabVIEW with a functional global (alternatively called a LabVIEW 2 global). Just have the VI be a part of your class and you can control its scope as you would any other class member. Quote Link to comment
twols Posted December 14, 2012 Author Report Share Posted December 14, 2012 The global variable was my first idea too, but I can't encapsulate it in a class. The FG should do it. Thank you! Quote Link to comment
MikaelH Posted December 15, 2012 Report Share Posted December 15, 2012 GDS's GOOP3/4 class type have support for this. You can look at those implementation to get ideas of different ways of doing this. //Mike Quote Link to comment
JamesMc86 Posted December 15, 2012 Report Share Posted December 15, 2012 You appear to be able to use a global variable in the same way in a class, it doesn't create directly under the class but you can add it and set the scope to private. 1 Quote Link to comment
mje Posted December 15, 2012 Report Share Posted December 15, 2012 I hadn't thought of that. Neat idea. Quote Link to comment
drjdpowell Posted December 15, 2012 Report Share Posted December 15, 2012 You appear to be able to use a global variable in the same way in a class, it doesn't create directly under the class but you can add it and set the scope to private. I’ve used that recently. Though a private global isn’t really “global". Quote Link to comment
MikaelH Posted December 16, 2012 Report Share Posted December 16, 2012 You appear to be able to use a global variable in the same way in a class, it doesn't create directly under the class but you can add it and set the scope to private. Remember that a Static attribute using e.g. Globals/Functional Global in a base class gets shared between two different sub classes. That might be something you want, but maybe you want this “global variable” to have one unique value per base or sub class. In that case you can use a Named single element queue, using the object's class name. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.