Jump to content

Any good tutorials about inhertance and shadowing in vb.net


Recommended Posts

Posted

I am learning about inertance & Shadowing in VB.net before interfacing VB.net with AutoCAD.

I am having problems with Shadowing concept. Is there any good tutorials that keeps these

oop concepts simple with simple examples?

Thank you,

Posted

Here is one example where VB differs.

 

A good book about Visual Basic or google should help

http://msdn.microsoft.com/en-us/library/ms172785.aspx

 

To show a example how they differ

*****EDIT*********

Code will not format correctly it puts it on one line

[color=blue]Public[/color] [color=blue]Class[/color] [color=#2b91af]Shape[/color] 
   [color=blue]Overridable[/color] [color=blue]Sub[/color] Draw     
    MsgBox([color=#a31515]"Base Draw"[/color])     
   [color=blue]End[/color] [color=blue]Sub[/color]     

  [color=blue]Sub[/color] SaveToDatabase   
    MsgBox([color=#a31515]"Base SaveToDatabase"[/color])    
  [color=blue]End[/color] [color=blue]Sub[/color]
[color=blue]End[/color] [color=blue]Class[/color] 

[color=blue]Public[/color] [color=blue]Class[/color] [color=#2b91af]Rectangle[/color]  
 [color=blue]Inherits[/color] [color=#2b91af]Shape[/color] 

   [color=blue]Public[/color] [color=blue]Overrides[/color] [color=blue]Sub[/color] Draw()     
   MsgBox([color=#a31515]"Overrides Draw"[/color])    
  [color=blue]End[/color] [color=blue]Sub[/color]   

[color=blue]Shadows[/color] [color=blue]Sub[/color] SaveToDatabase    
   MsgBox([color=#a31515]"Shawdows SaveToDatebase"[/color])    
[color=blue]End[/color] [color=blue]Sub[/color] 
 [color=blue]End[/color] [color=blue]Class[/color]  

[color=blue]Public[/color] [color=blue]Class[/color] [color=#2b91af]Triangle[/color]    
[color=blue]Inherits[/color] [color=#2b91af]Shape[/color]  

  [color=blue]Public[/color] [color=blue]Overrides[/color] [color=blue]Sub[/color] Draw()       
MsgBox([color=#a31515]"Overrides Draw"[/color]) 
  [color=blue]End[/color] [color=blue]Sub[/color] 
  [color=blue]Shadows[/color] [color=blue]Sub[/color] SaveToDatabase       
MsgBox([color=#a31515]"Shawdows SaveToDatebase"[/color]) 
  [color=blue]End[/color] [color=blue]Sub[/color]
[color=blue]End[/color] [color=blue]Class[/color]

 

Now when you use them in this context you can see the difference

     [color=blue]Dim[/color] rec [color=blue]As[/color] [color=#2b91af]Shape[/color] = [color=blue]New[/color] [color=#2b91af]Rectangle[/color]     
  rec.Draw()     
  rec.SaveToDatabase() 
       [color=blue]Dim[/color] tri [color=blue]As[/color] [color=#2b91af]Triangle[/color] = [color=blue]New[/color] [color=#2b91af]Triangle[/color]     
  tri.Draw()    
   tri.SaveToDatabase()

Posted

I think understand overwriting but I am having a tough time with vb.net Shadowing.

What does shadowing mean in programming? Is there any good simple examples?

An example that includes a test routine that uses the shadow routine.

Please keep it simple as possable.

thank you,

Posted

Maybe someone else can explain better but if you understand overrides then I would guess you have a basic understanding of inhertance and polymorphism.

 

Some people might argue that shadows is not a OOP concept and you should not use it.

 

But other than taking the information from these links and posting what they already say,

these links give a good description.

 

http://msdn.microsoft.com/en-us/library/c4swkw24.aspx

http://msdn.microsoft.com/en-us/library/ms172785.aspx

http://msdn.microsoft.com/en-us/library/hya04w5b.aspx

http://msdn.microsoft.com/en-us/library/10kws135.aspx

http://msdn.microsoft.com/en-us/library/b25c8bbc.aspx

Posted

I guess I need to start form the bottom with a good oop tutorial that gets to the point.

I have been searching the web but it seems like I get lost because there is too much info.

Is there a oop tutorial that that gets to the point and is short and somewhat simple?

I am sure it is going to take some time to absorb oop info.

I want to work on inhertance and polymorphism so I can understand those concepts.

Thank you,

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...