LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview child class data access

Solved!
Go to solution

All data in LVOOP is private. If you need data accessed in your child classes you should right click your parent class in your project and choose "create VI for data member access." Select if you want read or write access (or both) and select the data members you want to access. This will automatically create the accessors for you. You will then want to make the accessors protected by right clicking them in the project and setting their access scope. The reason they are made protected is so that child classes can access them, but other classes cannot.

0 Kudos
Message 11 of 14
(764 Views)
Solution
Accepted by topic author Velpula

Velpula,

 

I made the same mistake when I was looking at LVOOP the first time.  If you actually put a probe ont he wires for your classes you'll see that you have copies of all the data you define like that.  Not only a waste of memory, but you access each one separately.  You need to make "Accessor VIs" for the data fields you want to be readable in teh children and then access them this way.  You can't access the cluster of the parent directly within a child.

 

If you right-click on the parent class in your project and choose Create-new-accessor VIs (Text may differ) you can choose which fields you want to make available and LV will create the VIs for you.

 

Shane.

0 Kudos
Message 12 of 14
(752 Views)

Thankyou all. Very helpful

0 Kudos
Message 13 of 14
(745 Views)