LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Class in LV

why does the derived class constructors if called in a application, referenced by the parents parent object gives Error 1448, even if to more specific class function is used among them at run time.

 

lvoop.png

 

Help me, discover more!! Smiley Wink

0 Kudos
Message 1 of 22
(4,029 Views)

I think you're going to have to attach some code to help us out. The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run.

 

My guess is that you have instantiated a telecom class object and then tried to cast that to a mobile phone class.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 22
(3,989 Views)

@Jacobson-ni wrote:

The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run...

 

...you have instantiated a telecom class object and then tried to cast that to a mobile phone class.


Sorry for the mistake.. 

 

bad_typecast.PNG

 

Let me explain the situation:

The Telecom is the root class as you can see in the hierarchy, am not giving the instantiate telecom's object here but, the each class object is connected at the other end of event structure: as device handling which predicts the input class object at that instant when user selects that control.

I'm think I need to find a procedure to publish Mobile class.Obj to be visible on the front panel of my application only through static read_Accessors. And note that, there are/should be no indicators inside my dynamic methods (MobilePh_has only dynamic dispatches).

 

I have attached the project for reference and please point out if there are any other corrections so that I could make my learning proper.

 

Note: This error persists only when device handled is not Mobile phone. 

0 Kudos
Message 3 of 22
(3,975 Views)

Why am I unable to connect all accessors directly in the application vi or through static methods too from the same class.. Smiley Sad

0 Kudos
Message 4 of 22
(3,961 Views)

@PriyadarsiniS wrote:

@Jacobson-ni wrote:

The picture you are showing has a broken run arrow so it won't throw error 1448 because it can't even run...

 

...you have instantiated a telecom class object and then tried to cast that to a mobile phone class.


Sorry for the mistake.. 

 

bad_typecast.PNG

 

Let me explain the situation:

The Telecom is the root class as you can see in the hierarchy, am not giving the instantiate telecom's object here but, the each class object is connected at the other end of event structure: as device handling which predicts the input class object at that instant when user selects that control.

I'm think I need to find a procedure to publish Mobile class.Obj to be visible on the front panel of my application only through static read_Accessors. And note that, there are/should be no indicators inside my dynamic methods (MobilePh_has only dynamic dispatches).

 

I have attached the project for reference and please point out if there are any other corrections so that I could make my learning proper.

 

Note: This error persists only when device handled is not Mobile phone. 


And that is the way it should work. You can't cast a class object to a sibling class, you can only cast a cast to the correct type of the object or to its parents.
So a Telefone object, running on the telecom wire, can't be cast to a mobile.

The error you get is correct. If you put a Telefon, Telegraf or  Walkie Talkie object on the wire you will get that error, as they are on a mobile class type, or any of the mobile class parent type. 

 

The important part is what class object is acutal running on the wire, not the wire class type. 

0 Kudos
Message 5 of 22
(3,928 Views)

You are correct!!

I was just reminding myself about abstract and encapsulated behaviors.

 

So, is there any easy way to play/accessible procedures to show an output on my Application, which is a data from child class. 

0 Kudos
Message 6 of 22
(3,920 Views)