LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to copy parent properties from child class to another child class at run time?

Solved!
Go to solution

Hi all,

 

I have 3 classes:

A: parent class

B and C: child classes

 

At run time, I'd like to istantiate an object of the class C from an existing object of the class B.

In particular: I have an object of class B with its properties; then, I want to create an object of class C whose parent properties are "taken" from the object B.

I tried using "To more generic class" and "to more specific class" but without success.

 

Can you help me?

0 Kudos
Message 1 of 4
(4,397 Views)

At the top of my head, you could have a method of the parent class that transfers the private data from one object to another.  With dynamic dispatching, I see no reason why it wouldn't work.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(4,393 Views)
Solution
Accepted by topic author sqrt(-1)

You basically have to write the explicit code which will take all the relevant data and pass each thing to the new object.


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(4,368 Views)

@tst wrote:

You basically have to write the explicit code which will take all the relevant data and pass each thing to the new object.


Thanks you tst. This is exactly what I need to know. I will copy each single property.

Thanks

0 Kudos
Message 4 of 4
(4,361 Views)