07-13-2013 10:41 AM - edited 07-13-2013 10:43 AM
Hello,
is a coercion dot, when working with different classes with same parent an issue? Is there any way how to remove it ?
07-13-2013 01:04 PM
What the coercion dot is telling you is that the data type of the queue is class A and the data type of the the LogElement out control is class B, which inherits from A. You could remove it by upcasting the wire to class A, but there's no real point to it, as you will only be doing the same work that LV is doing and this makes the structure of the code clearer.
The code will work. It will pass whichever element you put through it and it will require all of those elements to be either B or another class which inherits from B.
On the dequeue side, any element you dequeue will have a wire of type A. The actual class on the wire might be of type B, but that's not a problem unless you want to statically call VIs from class B, in which case you will need to cast the wire to type B.
07-13-2013 01:28 PM
Thank you,
I was concerned over the execution speed. I will try some benchmarking...
07-13-2013 01:43 PM
I wouldn't bother benchmarking that. There should be no effect on the execution speed, as there's no actual conversion taking place and no creation of a new object. It's simply changing the type of the wire, but the object is still the exact same object.
07-15-2013 03:08 AM
Hi Bublina,
there is no problem with coercion dot when you connect miscellaneous classes with same parent. In this case, the interface will be the same (it comes with the parent and inheritance) and coercion dot means only that there is different class connected. You cannot remove the coercion dot, but no speed issue will be there.
The code you provided is OK, there is nothing to worry about.
Martin