Jump to content

Factory Pattern Delema


Recommended Posts

How do I instantiate every child so that I can call supported modules in each child to then determine which child to instantiate? In addition, how do I only call children that I am their parent?

I have stumbled upon a difficult problem. I am writing a HAL where the parent is the type of instrument (for example, power supply) and the child contains the specific code for a specific instrument. It also seemed to make sense that the child also contained the code specifying which specific instruments it supports. Does it make sense to try to instantiate every child object so that I can call supported instruments and then determine which one to keep? Is there a better way to do this?

Also, since this is a plug-in architecture, I plan to have one folder with each class in it as a packed project library. But it will potentially have power supply parent and children as well as spectrum analyzer parent and children and so on. How do I only open the power supply classes?

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.