CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002
    Posts
    195

    User Cotrol Inheratance

    Okay I'm just wondering if this is even possible. I tried it and get an error but maybe I'm tring the wrong way. Can a usercontrol inherate an application defined class ie.. could you inhearate a classic rect class into a user control to add the hight and width properties to the control without haveing to do all the coding all over again? Currently I just declair a private instance of the class within the control and then encapsalate. It would be nice if I could just inherit all the functionality of my classes into controls designed to implament the classes.

  2. #2
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: User Cotrol Inheratance

    According to vbdotnetheaven

    Structs & Inheritance.

    There is no inheritance for structs as there is for classes. A struct can't inherit from another struct or class and it can't be the base class for a class. But remember that in VB.NET all types are directly or indirectly inheriting from the super base class object and hence the structure also. Since structs doesn't support inheritance, we can't use the keywords virtual, override, new, abstract etc with a struct methods. VB.NET struct types are never abstract and are always implicitly sealed. The abstract or sealed modifiers are not permitted in a struct declaration.

    Since inheritance is not supported for structs, the declared accessibility of a struct member can’t be protected or protected internal. Since all struct types are implicitly inherit from object class, it is possible to override the methods of the object class inside a struct by using the keyword override. Remember that this is special case in VB.NET structs.
    So if you need to muti-use a Size Struct, build it as a class and then you can inherit it multiple times...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured