LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GOOP child object creation

Solved!
Go to solution

HI all!

I´m back with a new GOOP question in my effort to get a grip on OOP in LabVIEW.

When a child object is created in GOOP, the parent is first created (if not created before). The parents DVR is via a U32 put in Ref, but this value is then overwritten by the new U32 (DVR) for the child. Isn´t the parent DVR then lost forever? (I guess not, I must be missing something ... ).

I´ve taken the liberty of compacting the GOOP diagram below for clarity.

 

CuriousSwede_0-1702630287080.png

 

0 Kudos
Message 1 of 5
(390 Views)

* The parents DVR = The parent´s DVR

0 Kudos
Message 2 of 5
(355 Views)
Solution
Accepted by topic author CuriousSwede

Hi CuriousSwede,

 

Each level in the class hierarchy has its own U32 "Ref" representing the DVR to the associated attributes.

The "Ref" that is set in your diagram belongs to the private data of your child class, while the parent "New" writes the its own "Ref", which is hidden from the child class (because private). They have the same name but are private data of different classes.

 

If you inspect your Child class with the Context Help, you may see something like that:

raphschru_0-1702645836180.png

 

So each GOOP class is an assembly of all the U32 Refs of all the levels from the top ancestor down to the child class itself.

 

Regards,

Raphaël.

Message 3 of 5
(331 Views)

Thanks Raphaël,

 

your explanation is what I ought to have expected.

It´s just that my imagination wasn´t good enough to realize that the parent Ref in the private data of the child is hidden, and it is only the child Ref that is shown and available in the child class.

Impressive implementation to my simple mind.

0 Kudos
Message 4 of 5
(318 Views)

… and without your help I don’t know how long it would have taken me to figure that out.

0 Kudos
Message 5 of 5
(307 Views)