Jump to content
Daryl

LVOOP Noob Question

Recommended Posts

Ok, so I'm trying to teach myself LVOOP and I feel like a total Labview Noob.

Can someone please explain to me how this is possible???

post-5331-0-06481400-1314105951_thumb.pn

Share this post


Link to post
Share on other sites

The typecast would occur if UI Initialize is a child of UI Command Manager. Any chance that's the case?

Tim

Share this post


Link to post
Share on other sites

I'm really not sure how to know if it is or not? How do I figure that out?

Share this post


Link to post
Share on other sites

"UI Initializer" is definitely a decedent of "UI Command Manager." What you are looking at is a very important concept in lvclasses. There are several ways to view the class hierarchy. The most common is to find the class within the project explorer, right click on it, and select properties. in the subsequent dialog, select the "inheritance" option. this will show you the class hierarchy. Given what you are showing here, there will likely be many classes within the hierarchy.

Share this post


Link to post
Share on other sites

Thanks - that is very helpful but I cant find the "UI Initialize.lvclass" in the project explorer.

Is it possible to have a different name on the block diagram?

:wacko:

Daryl, if this is your first stab at LVOOP, thats probably not the best example to start with!

Try the Graphics example that ships with LV if you want to learn a bit about how inheritance is implemented in LVOOP. I would not even try this though until you are really comfortable with Composition and basic LVOOP principles.

It is my first stab and right now it looks like LVOOP breaks all the rules!!! :wacko:

Share this post


Link to post
Share on other sites

It is my first stab and right now it looks like LVOOP breaks all the rules!!! :wacko:

Actually it's not breaking the rules. The way inheritance of objects work it is the same as if you wired a I16 into a queue set up for a I8 (well roughly). In my example both are numeric types and LabVIEW type casts for the correct type. In the code you are looking at both are "UI Command Manager" type and LabVIEW type casts appropriately.

Tim

Share this post


Link to post
Share on other sites

ok thanks.

I have another question about the snippet above. The UI Command Manager.lvclass appears to have a data type of an empty cluster. So I guess once I get over the fact that this is possible, does that mean that a child class (UI Initialize.lvclass) can have a data type of a cluster of anything?

Share this post


Link to post
Share on other sites

Realized that refnums would have been a better analogy, but...

Highly recommend going to LVOOP 101 and starting there. But, to answer your question, you are looking at the private data of the class. The class isn't required to have any private data, hence why it can be "empty". A child class will inherit all of the data from the parent class plus everything it defines. So, for example, a vehicle class can have the number of passengers in it. A child class of the vehicle could be car and boat. The car would have wheels, brakes, etc., and the boat would have sails, rudder, etc., defined in addition to what makes them vehicles.

Tim

Share this post


Link to post
Share on other sites

Thanks for the help, i'm starting to get it. I kind of jumped right into the deep end trying to understand design patterns when I needed to understand how classes, encapsulation, inheritance, etc are implemented first.

I typically need to play with things for a while before I start reading too much, it just sinks in a lot better that way for me.

Share this post


Link to post
Share on other sites

I agree with Neil here - I would start by learning encapsulation before moving onto inheritence and polymorphism.

I learnt LVOOP by starting to use it in my projects for encapsulation, replacing code I would have otherwise passed around as clusters.

I also worked through the shipping examples - they were helpful too.

Share this post


Link to post
Share on other sites

Highly recommend going to LVOOP 101 and starting there.

Tim

I have done a quick web search for LVOOP 101, but can't find anything relevant. Do you have a web address?

Cheers

Ian

Share this post


Link to post
Share on other sites
I have done a quick web search for LVOOP 101, but can't find anything relevant. Do you have a web address? Cheers Ian

I was referring to basics versus the example this topic started with (so a "101" course, though not necessarily a class). The class jgcode linked to would be a good introduction.

Tim

Share this post


Link to post
Share on other sites

I was referring to basics versus the example this topic started with (so a "101" course, though not necessarily a class). The class jgcode linked to would be a good introduction.

I prefixed my statement with "guessing" to cover me in case I was wrong - I guess it worked! :lol:

Share this post


Link to post
Share on other sites

Can someone please help me understand "friends"

Write Boolean.vi is inside Sub2.vi. Write Boolean.vi is community scope. Child.lvclass is freinds with Sub2.vi and Sub2.vi is friends with Child.lvclass. Why do I have a broken arrow? I also tried putting sub2.vi inside a library and making it friends with Child.lvclass but still have a broken arrow. Does Sub2.vi have to be part of a class?

post-5331-0-36946200-1314278843.png

Share this post


Link to post
Share on other sites

Can someone please help me understand "friends"

People would be more able to help if you posted your project rather than the snippet.

The concept of friends is along the lines of such... Say I have a drill and know two people "Person A" and "Person B". Both people want to borrow the drill. Person A is a friend, so I say sure, go ahead and borrow the drill. Person B is unknown to me, so I tell him to bugger off and don't let him have access to the drill. Person A may or may not consider me a friend, but that doesn't matter as I believe he is one and will grant him access to my drill.

Tim

Share this post


Link to post
Share on other sites

Don't bother learning about "friends" yet. It's not hard to understand, but you shouldn't need it in most applications. Because it's a very rarely needed feature, while you're still learning, I'd push that topic off for a while.

Here... start with this 1 hour presentation that will get you all the basics:

http://zone.ni.com/wv/app/doc/p/id/wv-1766

Then you can look at the "Additional Resources" section of the LVOOP FAQ for more tutorials, white papers, Powerpoint walkthroughs and other learning materials to fit your learning style:

http://zone.ni.com/devzone/cda/tut/p/id/3573

Share this post


Link to post
Share on other sites

Don't bother learning about "friends" yet. It's not hard to understand, but you shouldn't need it in most applications. Because it's a very rarely needed feature, while you're still learning, I'd push that topic off for a while.

Here... start with this 1 hour presentation that will get you all the basics:

http://zone.ni.com/w...oc/p/id/wv-1766

Then you can look at the "Additional Resources" section of the LVOOP FAQ for more tutorials, white papers, Powerpoint walkthroughs and other learning materials to fit your learning style:

http://zone.ni.com/d...a/tut/p/id/3573

Thanks, that video was very helpful

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.