Jump to content

Preventing a Class from being Inherited


Recommended Posts

Does anyone have a method for preventing a class from being inherited by other classes in LVOOP?

This question came up while researching Object-Oriented API Design guidelines, one I came across in text-based languages was "Design and Document for Inheritance or Else Prohibit it" (see Slide 26 of http://lcsd05.cs.tam...des/keynote.pdf; there is also a video of the presentation on YouTube). In the case of classes that are reused within a team or publicly distributed, the issues discussed there with changing implementation details in the class being distributed potentially breaking children seems to still be valid in LabVIEW.

Link to comment

You can inherit a class if you can see it, so I don't think there is a way to expose a class and not make it inheritable. The next best thing would be to make data and VIs private.

Is this a concern, though? The person creating the child class either has access to the source code, or is accessing a distribution of some kind (source distribution or packed library). The first case is moot as the person can change the source to be whatever they want. The second case is one where the original developer has chosen what to expose though design.

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.