From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

inheritage bug

Hi,

 

I try to use "to more specific" VI to access child class (B) from class parent (A) // see attached Classe.bmp //. I can run the VI (no wire conflict) but I get the err code 1448, wich I can't interpret...

I construct class B with iheritage from class A //see attached Inheritage.bmp//. I would like to use methods and parameters of A (violet wire) in B.

 

What I am doing wrong ?Is it a bug or what ? I see LV exemple NavScreen.lvlib that do exactly the same with ClickableText.class from Link.class...

 

Thank's in advance I am very stucked here.

Download All
0 Kudos
Message 1 of 6
(7,681 Views)

Hey bull balls Smiley Very Happy

 

I think the following thread is talking about the same problem: http://forums.ni.com/ni/board/message?board.id=170&message.id=238663&requireLogin=False

 

Hope this helps,

Christian

0 Kudos
Message 2 of 6
(7,659 Views)

Hi, Thank's for your reply.

 

I have already read it & it seem's to be no issue, but what's weird is that in the NI exemple (LV8.5), they use exactly the "to more specific".

 

Anyway, how can I access parent's parameters from child ? Any idea ?

 

Thank's

0 Kudos
Message 3 of 6
(7,638 Views)

Hi!

 

If I'm not mistaken you cannot access the parents object data directly. Instead, implement accessors, functions that reads or writes object data, in the parent class and use these functions in the child class. If you do not wish these functions to be used outside these classes inheritance scope, make their access scope 'protected'.

 

At least in 8.6 there are templates for  Data Member access vi:s if you right click your class.

 

Hope this helps.

 

//M



CLA
www.dvel.se
0 Kudos
Message 4 of 6
(7,617 Views)

Type casting a class wire has two effects. It changes the type of the class on the diagram so that you can wire child methods directly. Secondly, at run-time, the expectation is that the actual class on the wire is of the type you cast or a child of the casted type. If it is not, you will get an error.

 

To access a parent's parameter, you need to create an accessor VI on the parent. This accessor allows the child to get the parent data.

George M
National Instruments
0 Kudos
Message 5 of 6
(7,612 Views)

Hello,

How to create that accessor vi .I am unable to pass child parameter/control values to parent class parameters/controls. I tried with adding child as friend to parent and also inheritance from child to parent but not getting to know how to update child class control value into parent class

0 Kudos
Message 6 of 6
(3,719 Views)