I've been trying to dig into LVOOP but I've run into some issues. This is my first attempt at OO design and implementation so I'm thinking I would get some advice before I pull all my hair out.
My objective is to build an application that could acquire data from multiple source. This application will have a means to configure each data source and load/save configurations to file.
My first crack at this from an OO approach:
1- Create class called "unit". This represents a data source. Class data is "name" and "description"
2- Create class called "serial unit". This inherits from "unit" but also has additional class data such as visa refnum, com functions. This class also has an array of "Channels" objects
3- Create class called "Channels". Contains channels information such as name, location, units, scaling etc.
4- Create class called "Configuration". This class contains an array of "unit" objects along with config path.
In my app, I start by creating a "Configuration" object. The user can then add a "unit" to the configuration. Now the GUI to add a unit will change depending on the type of unit they would like to add. So if a user chooses to add "serial unit", I need to somehow convert my "unit" object (element in configuration) into a "serial unit" object (so that I can access "serial unit" specific methods). I've tried using "to more specific class" but it gives me an error Error 1448: Bad type cast. LabVIEW cannot treat the run-time value of this LabVIEW class as an instance of the given LabVIEW class."
My next crack would be to change my configuration class to contain and array of serial units, array of daq units, etc.. for all my unit classes, rather than an array of "units". Is this the correct approach?