LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is different between classes and type def?

When I use my classes, other Vis change properties of class when I change they in a class. The type definitions do the same. So what is diferent?

0 Kudos
Message 1 of 4
(3,176 Views)

Hi Forest, you have observed that classes are basically a fancy typedef cluster, but there are some other implications. With a class, you can inherit from other classes, not so with typedefs. Also with a class, the data is private, and can only be accessed by VIs within the class. A typedef (with public scope) can be accessed from anywhere.

 

This is just a quick answer, you can find many-paragraph articles on LabVIEW object oriented programming which will give you more info.

0 Kudos
Message 2 of 4
(3,151 Views)

Dynamic Dispatching

 

Dynamic Class instaciation

 

Support for class definition chages

 

Fancy wires

 

the opportunity to use the word "La-Voop" in every other sentence.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 4
(3,131 Views)

It's also worth noting that in classes, the default values are part of the definition of the class where for a type definition they are not.

 

That means that if you put a class constant on a block diagram and update the defaults you'll be updating the constant, but if you put a type definition constant down on a block diagram and update the default values of the typedef, all of your existing code won't have the new defaults but if you add a new one somewhere it will.

Message 4 of 4
(3,126 Views)