LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class override, how to create the child class and then the base class

Solved!
Go to solution

I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.

 

My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.

My problem is, i want first to create one child class and after i will see every thing is work,  start to create the base class. that way i will see if am thinking the right way.

My question is Smiley Happy

How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?

I tried to search in the property of the class but i didn't see nothing.

 

Thanks

0 Kudos
Message 1 of 8
(4,060 Views)

@Johnny1986 wrote:

I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.

 

My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.

My problem is, i want first to create one child class and after i will see every thing is work,  start to create the base class. that way i will see if am thinking the right way.

My question is Smiley Happy

How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?

I tried to search in the property of the class but i didn't see nothing.

 

Thanks


I think you may be a bit confused with the terminology.

 

You start with the base class and derive child classes from it.

 

0 Kudos
Message 2 of 8
(4,055 Views)
Solution
Accepted by topic author Johnny1986

This can be done and I've done it on occasion.

 

You simply create the base class with the dynamic dispatch methods you require (connector panes need to be identical to thos of the child class).

 

Then set the inheritance of the class to inherit from this base class.  If your method is defined as a dynamic dispatch method in the parent, you'll most likely now have some errors (unless your child method was already DD in which case you might just be OK already).

 

To change the inheritance of a class, right-click the properties of the class in your project and select properties.  I believe the ineritance tree is at the lower end of the properties.  Click on the "change inheritance" (or something similar) to choose the class from which you now wish to inherit.

Message 3 of 8
(4,046 Views)

I am sorry but i don't think that you did understand me

 

What if i created a class that Control on a specific DMM Ver.X , after a month the customer tell me that he need the software to support 2 DMM Ver., Ver.X and Ver.Y

 

Then for that i will create a child class for the new DMM for Ver.Y and a base class that can control on both DMM Classes.

 

How can i config the "old" class DMM Ver.X,  to be override of the New Base class.

0 Kudos
Message 4 of 8
(4,027 Views)

I understood perfectly.

 

Which part of my post are you having trouble with?

0 Kudos
Message 5 of 8
(4,018 Views)

@Johnny1986 wrote:

I am sorry but i don't think that you did understand me

 

What if i created a class that Control on a specific DMM Ver.X , after a month the customer tell me that he need the software to support 2 DMM Ver., Ver.X and Ver.Y

 

Then for that i will create a child class for the new DMM for Ver.Y and a base class that can control on both DMM Classes.

 

How can i config the "old" class DMM Ver.X,  to be override of the New Base class.


 

The objective is to create *one* base class.

From that base class derive child class for DMM version X and child class for DMM version Y and in the future DMM version Z.

 

 

 

 

0 Kudos
Message 6 of 8
(4,008 Views)

In addition, have you identified the common methods?

 

Do they have identical parameters and connector panes?

0 Kudos
Message 7 of 8
(4,005 Views)

Thanks.

It Work perfectly.

 

Sorry this is the first time i tried to implement OOP in labview, than at first i didn't write the code properly and i got an error.

 

I have anther question about OOP,

Until now i create the giant cluster that contain a notifier and queue, i use that connect it to all the while Loop(4 loop), that way i communicate between the loop, it work well.

 

Now i want to implement every thing in classes, what is the best way to connect every loop(i have 4 loop) with out having 10 wire all over the main VI.

I can think on

1. create a cluster of object

2. create a object of objects

 

If you have a site/data that i can learn about the right way to write a OOP code in labview it will be the best.

 

Thanks For you help

0 Kudos
Message 8 of 8
(3,996 Views)