LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inheritance, Interfaces and mandatory overrides

Solved!
Go to solution

Hey guys,

 

sorry to bug you with this most likely basic question, but somehow my brain does not seem to be working right now.

 

I have a parent class BaseClass and some child classes ChildClass1 and ChildClass2 that inherit from BaseClass.

BaseClass currently inherits from the Interface i_BaseClass which implements the method SetType.vi. This means that BaseClass has to implement a version of SetType.vi.

 

Now my problem is, that I am creating a Framework where multiple developers can create ChildClasses and I want to make sure that every developer creates a version of SetType.vi.

In my opinion the easiest way to solve this problem would be to let each child class inherit from the i_BaseClass interface. But the problem is, that if the developer forgets to setup the interface inheritance SetType.vi does not have to be implemented although I want him to do that.

 

Is there any way to somehow specifiy that in BaseClass that this VI override has to be implemented in any ChildClass without having to inherit from the interface?

 

If BaseClass inherits from i_BaseClass, then BaseClass already has to implement SetType.vi and the ChildClasses simply inherit this method and again do not have to override it.

 

Thanks a lot in advance!

0 Kudos
Message 1 of 3
(1,447 Views)
Solution
Accepted by topic author Jenso

In the Class Properties of your parent class, go to Item Settings, navigate to SetType.vi and enable "Descendants must override".

Message 2 of 3
(1,415 Views)

That is exactly what I was looking for. Thanks!!

0 Kudos
Message 3 of 3
(1,387 Views)