I haven't worked a lot in labview, but I know we write c# class libraries to help our labview testing. I am writing some hardware testing through a c# class library project where I am using interfaces for various equipment we interact with (load, relays, source, etc) and an abstract class for each product so that I can implement base functionality.
Now, I haven't touched labview but my googling suggests there is no reason that labview shouldn't be able to create objects of c# classes and call instanced methods? In labVIEW terms (so I can support our labVIEW guy) how do you achieve this?
Here is a code example of the architecture I have set up.
public abstract class ClassA {
public virtual int Test() {
/** Do some things **/
return 0;
}
}
public class ClassB : ClassA {
private IDcSource source;
public ClassB (IDcSource source)
{
this.source = source;
}
public override int Test() {
/** Do product specific thing **/
source.On();
return base.Test();
}
}
public interface IDcSource {
void On();
void Off();
}
public class dcSource1 : IDcSource {
private int num;
public dcSource1 (int i) {
this.num = i;
}
public void On() {
/** Turn on **/
}
public void Off() {
/** Turn on **/
}
}
In a c# console app I would do the following, allegedly this approach doesn't work in labVIEW?
ClassB product = new ClassB(new dcSource1(1));
Console.WriteLine($"Result of test {product.Test();}");
EDIT:
Furthermore, is there any reason labVIEW can't handle classes inheriting abstract classes?