Example of Innerclass in vb.net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Annie

    #1

    Example of Innerclass in vb.net

    hello guys,

    I am bit confused with the concept of inner classes....

    why do we need them and what are their advantages?

    I had a search in google and msn but not very luck to find any detail or
    example of its usage

    any comment, links, resources will be highly appreciated ...

    regards



  • Michel Posseth [MCP]

    #2
    Re: Example of Innerclass in vb.net

    Innerclasses ??

    guess you do not find so much info about it, as this is more used in Java,
    for what in VB is called Nested Classes (AFAIK same thingy but different
    name )


    Visual basic lets you nest Class definitions

    Class Outer
    --
    class Inner
    --
    End class
    End class


    all normall scope rules arre valid in this cunstruction ( unlike outer
    classes a inner class can be marked as private )
    Nested classes serve a variety of purposes example : encapsulate data inside
    the class that uses them and avoid making them visible to other parts of the
    application
    ( the inner class should in this situation be marked with private scope )


    if other than private the nested class is visible to the outside usin the
    dot syntax

    dim Obj as new Outer.Inner()

    for an object oriented coder inner classes are especially handy for grouping
    purposes ( the same as you might do now with namespaces )



    so i hope i have shined some light on the subject
    :-)

    regards

    Michel Posseth [MCP]


    "Annie" <myjunksandforu ms@gmail.com> schreef in bericht
    news:448bdff7@d news.tpgi.com.a u...[color=blue]
    > hello guys,
    >
    > I am bit confused with the concept of inner classes....
    >
    > why do we need them and what are their advantages?
    >
    > I had a search in google and msn but not very luck to find any detail or
    > example of its usage
    >
    > any comment, links, resources will be highly appreciated ...
    >
    > regards
    >
    >
    >[/color]


    Comment

    Working...