05-12-2015 08:45 AM
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
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
Solved! Go to Solution.
05-12-2015 08:53 AM
@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
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.
05-12-2015 09:03 AM
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.
05-12-2015 09:51 AM
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.
05-12-2015 10:04 AM
I understood perfectly.
Which part of my post are you having trouble with?
05-12-2015 10:09 AM
@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.
05-12-2015 10:11 AM
In addition, have you identified the common methods?
Do they have identical parameters and connector panes?
05-12-2015 10:23 AM
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