Jump to content

Object-oriented programming: Difference between revisions

From LabVIEW Wiki
Hooovahh (talk | contribs)
Created page with "Object oriented software designs in LabVIEW follow many of the same programming principals as object oriented software in [https://en.wikipedia.org/wiki/Object-oriented_progra..."
 
Hooovahh (talk | contribs)
No edit summary
Line 15: Line 15:
== External Links  ==
== External Links  ==
*[http://www.ni.com/white-paper/3573/en/ NI FAQ on Object Oriented Programming].
*[http://www.ni.com/white-paper/3573/en/ NI FAQ on Object Oriented Programming].
*[https://forums.ni.com/t5/LabVIEW-Development-Best/Introduction-to-Object-Oriented-Programming-and-Hardware/ta-p/3519580 Introduction to Object Oriented Programming] by Elijah Kerry
*[http://zone.ni.com/reference/en-XX/help/371361P-01/lvconcepts/creating_classes/ Creating Classes].
*[http://zone.ni.com/reference/en-XX/help/371361P-01/lvconcepts/creating_classes/ Creating Classes].
*[https://forums.ni.com/t5/LabVIEW-Development-Best/When-Should-You-Use-LabVIEW-Classes/ba-p/3478257 When should you use classes].
*[https://forums.ni.com/t5/LabVIEW-Development-Best/When-Should-You-Use-LabVIEW-Classes/ba-p/3478257 When should you use classes].

Revision as of 15:35, 30 November 2018

Object oriented software designs in LabVIEW follow many of the same programming principals as object oriented software in other programming languages. In general object oriented software is done in LabVIEW by first creating a class. This class is an object that has has the ability to add functionality to data. This allows for abstraction of the underlining data and allows operations to happen on a more segmented part of the application. This often leads to better reusability and scalability.

Access Scope

Object oriented software allows for specific data, or functions to have scope set to them which restricts access from other parts of the application. A common use for this is with internal references, or sessions, which if given to the rest of the application could be inadvertently closed. By keeping the internal references from being accessed externally, an object can have more control over who has access, and how its internals are accessed.

Inheritance

Using object oriented software in LabVIEW allows for a class to inherit from another class. This child class has the ability to call all the parents functions, but then also can optionally override a parents call if the VI is setup to be dynamic dispatch.

Dynamic Dispatch

Calling a parents initialize function might not be sufficient for all children, and so a dynamic dispatch call can override the parents call with the child's specific implementation. This child implementation can also call the parent's depending on how the VI is written.

External Links