Daryl Posted August 23, 2011 Report Share Posted August 23, 2011 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??? Quote Link to comment
Tim_S Posted August 23, 2011 Report Share Posted August 23, 2011 The typecast would occur if UI Initialize is a child of UI Command Manager. Any chance that's the case? Tim Quote Link to comment
Daryl Posted August 23, 2011 Author Report Share Posted August 23, 2011 I'm really not sure how to know if it is or not? How do I figure that out? Quote Link to comment
Jon Kokott Posted August 23, 2011 Report Share Posted August 23, 2011 "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. Quote Link to comment
Daryl Posted August 23, 2011 Author Report Share Posted August 23, 2011 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? 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!!! Quote Link to comment
Tim_S Posted August 23, 2011 Report Share Posted August 23, 2011 It is my first stab and right now it looks like LVOOP breaks all the rules!!! 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 Quote Link to comment
Daryl Posted August 23, 2011 Author Report Share Posted August 23, 2011 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? Quote Link to comment
Tim_S Posted August 23, 2011 Report Share Posted August 23, 2011 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 Quote Link to comment
Daryl Posted August 23, 2011 Author Report Share Posted August 23, 2011 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. Quote Link to comment
Michael Aivaliotis Posted August 23, 2011 Report Share Posted August 23, 2011 An easy way to browse the class (parent child) relationships is to go to the menu: View>LabVIEW Class Hierarchy Quote Link to comment
jgcode Posted August 23, 2011 Report Share Posted August 23, 2011 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. Quote Link to comment
Ian Posted August 24, 2011 Report Share Posted August 24, 2011 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 Quote Link to comment
jgcode Posted August 24, 2011 Report Share Posted August 24, 2011 I have done a quick web search for LVOOP 101, but can't find anything relevant. Do you have a web address? I am just guessing but I think Tim_S means attending the Object-Orientated Design and Programming in LabVIEW Course. Quote Link to comment
Tim_S Posted August 24, 2011 Report Share Posted August 24, 2011 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 Quote Link to comment
jgcode Posted August 24, 2011 Report Share Posted August 24, 2011 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! Quote Link to comment
Daryl Posted August 25, 2011 Author Report Share Posted August 25, 2011 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? Quote Link to comment
Tim_S Posted August 25, 2011 Report Share Posted August 25, 2011 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 Quote Link to comment
Aristos Queue Posted August 25, 2011 Report Share Posted August 25, 2011 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 Quote Link to comment
Daryl Posted August 26, 2011 Author Report Share Posted August 26, 2011 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 Quote Link to comment
Aristos Queue Posted August 28, 2011 Report Share Posted August 28, 2011 Glad I could help. :-) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.