Table Of Contents

Inheritance Relationships Between Classes

Version:
Last Modified: September 25, 2017

Inheritance is a feature of object-oriented programming that allows you to use code from an existing class in your project as a starting point to build a new, more specific class for the project. An object of the new class can access the fields of the class it inherits from, as well as any unique attributes you define for the new class. The new class also gains access to the protected VIs on the Member List of the existing class.

Inheritance in G Dataflow follows a hierarchy of parent and child classes.

  • Parent Class—Class that provides fields and methods for another class to use.
  • Child Class—Class that inherits access to the fields and methods of a parent class. A child class can extend or override the functionality of the methods it inherits to fit its own requirements. It can also include additional fields that apply only to the child class.

A child class can inherit from only one parent class. However, a parent class can provide inheritance to more than one child class in your project. If a parent class has more than one child class, the child classes are known as sibling classes. The series of classes that a child class inherits from are known as ancestor classes.

You can plan and track the inheritance relationships in your project with an inheritance hierarchy illustration. An inheritance hierarchy displays all of the classes in your project and the inheritance relationships between them. The class at the top of the hierarchy provides inheritance for all other classes in the hierarchy. Each arrow in the hierarchy points to a child class that inherits from a parent class.

spd-note-note
Note  

Projects do not currently maintain an inheritance hierarchy for you to view. It may be useful to prepare an inheritance hierarchy illustration if your project has a complex set of inheritance relationships.

The following illustration shows the inheritance of data attributes and member VIs throughout a hierarchy of generic classes.


Recently Viewed Topics