




NI имеет хороший обзор LVOOP, который необходимо прочитать, поскольку объектно ориентированный объект реализован уникальным образом для LabVIEW.
Вы пробовали использовать функции «в более общий класс» и «к более конкретному классу» на палитре управления приложением?
Для потомков это было перенесено на форумы ЛАВА. Пользователь Aristos Queue, один из разработчиков нативных объектно-ориентированных функций LabVIEW, ответил следующее:
Using a dynamic dispatch method in every class is the recommended way of handling this, although the recommendation is to create a method that does whatever it is you're trying to do. I'm guessing that you're thinking of a dynamic dispatch method that returns a name or ID of the object so you can say, "Is it equal to this? Ok, then it must be this class..." and then you do Action X if it is that class. If you write a dynamic dispatch method ActionX.vi and then override it appropriately, you'll save yourself on performance and have much easier time for code maintenance in the future.
You can also use the To More Specific node to test if a given object can be downcast to a given type -- this allows for inheritance testing as opposed to the name or ID comparison that only does type equivalence. If the To More Specific node returns an error then it is not of the destination type.
So your options are (in order of preference):
- dynamic dispatch method that does the action
- To More Specific node to do type testing
- dynamic dispatch method that returns name/ID of the class of the object
- Get Path of LabVIEW Object.vi (shipped in vi.lib in LabVIEW 8.5 but not added to the palettes until LabVIEW 8.6)
На самом деле мне нужен метод определения дочернего класса, к которому он принадлежит. Я не хочу его преобразовывать.