LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between Data member access static and dynamic accessors and static and dynamic methods

What is the major difference between Data member access static and dynamic accessors

&

static and dynamic methods in a LVOOP's.

 

 

 

 

You can't help everyone, but you can help someone!! Smiley Happy

Message 1 of 6
(7,664 Views)

@PriyadarsiniS wrote:

What is the major difference between Data member access static and dynamic accessors

&

static and dynamic methods in a LVOOP's.

 


First, static\dynamic data accessors are (a special kind) of methods.

Static methods (inc. data member accessors) cannot be overwritten by child classes.

 

That's about it if you forget about some details (dynamic dispatch methods can't be inlined, re-entrancy is limited to shared, to name a few).

0 Kudos
Message 2 of 6
(7,643 Views)

Can you define this with an example program, am new to using Dynamic data member accessor concept in LV-OOP's.

0 Kudos
Message 3 of 6
(7,618 Views)

@PriyadarsiniS wrote:

Can you define this with an example program, am new to using Dynamic data member accessor concept in LV-OOP's.


Where did you get the "Dynamic data member accessor concept" from? I don't think there is such a think. There's a "Data Member Access" concept, and there's a "Dynamic Dispatch" concept and a "Static Dispatch" concept.

 

Simply make a class and a child class. Add a Dynamic Dispatch VI to the parent, and find you can add the same VI to the child.

 

Add a Static Dispatch VI, and find you cannot add this VI to the child.

 

I personally never use "Data Member Access", at least not by using the option LV provides. I simply make a new VI (method). Like I said, a data access VI is a method. It's very confusing that you can make this method visible as a property node.

Message 4 of 6
(7,609 Views)

I'll explain a criteria :

I have a parent class, with 2 children classes.

Each child class has over-ridden methods from its parent. Which means the parent has created a dynamic dispatch for the particular or all methods created, under it.. in turn making the child to over-ride. And moreover, I have used static data member access for every data created.

 

Now, what am trying to get is:

On introducing a dynamic read/write -data member accessor. What would be the benefits when it gets to replace a static read/write -data member accessor ?! 

 

Am I clear!! Smiley Wink

0 Kudos
Message 5 of 6
(7,602 Views)

PriyadarsiniS wrote:

Now, what am trying to get is:

On introducing a dynamic read/write -data member accessor. What would be the benefits when it gets to replace a static read/write -data member accessor ?! 


Making methods (any method, including data accessors) static, gives a clear signal to other programmers that this method is not mend to be overloaded. That's the most important reason.

 

If you'd make a data accessor dynamic, you usually get confusing situations. Someone might try to overload the method, and the data does not end up in the parent data like it's supposed to. You can -add- functionality to the method, by forcing the creator of child class to unconditionally call the parent method.

 

In C++ there are also minor performance gains to static methods, but in LabVIEW I wouldn't worry about that.

0 Kudos
Message 6 of 6
(7,599 Views)