Jump to content

Could we create mltiple instances of a class


Recommended Posts

Hi all,

My project is working with different device with different type of communication. Each device has different speed of acquiring data base on type of connection.

I have already created a class DataIO with different child class correspondent with each kind of device because each device has different read VI.

Now I make another class called Pooller which in its process VI will call the Read VI in the DataIO class and pass it into an array. The problem is because I have different speed for different device, I want to have different process run simultaneously to read data from each device. I try to create multiple instances on the same class and assign different type of device for each instance, but it's not work. I did like this because I still think it like object oriented programming in C.

My question is can we create multiple instances on one class? Or we have to create different child class for each instance.

Thank you in advance for your time reading and answering this topic.

Thang Nguyen

Link to comment

QUOTE(Thang Nguyen @ Feb 27 2007, 11:34 PM)

My question is can we create multiple instances on one class? Or we have to create different child class for each instance.

In LabVOOP you create a new instance of a class by forking the wire. Two wires means two instances. LVOOP wires act in exactly the same way as clusters with the exception that the private data is hidden and only visible to class methods. When you fork a cluster wire, you get two clusrers, right? Then you can edit the content of one cluster and you have two instances of the same cluster type. Classes work the same way. If your data in a cluster is a reference, then forking the wire doesn't really make a new instance unless you change the refenrece in one of the wires.

Perhaps you could post some of your code. I think you don't fully get the LabVOOP yet and it would be easier to see what you don't understand correctly if we could see your code or relevant parts of it.

Tomi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.