Results 1 to 15 of 15

Thread: [RESOLVED] Classes hierarchy

Threaded View

  1. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Classes hierarchy

    Well the mcolEmployees has For:Each capabilities, but since your collection is in a class, and the class is a wrapper for the collection, you have no way of exposing the collection's For:Each ability, other than exposing the collection itself which you wouldn't normally want to do. You don't want the user directly manipulating your class' collection. If you did, it would work like this
    Code:
    Pubic Property Get TheCollection() As Collection
        Set TheCollection = mcolEmployees
    End Property
    
    ' then the user can do
    Dim V As Variant
    For Each V In Class1.TheCollection
       ....
    Next
    Edited: By using For:Each, yes the user is directly manipulating your class' collection. However, by exposing the class thru a property, the user could do horrible things like: Set Class1.Collection = Nothing, or setting it to another collection entirely.
    Last edited by LaVolpe; Jun 22nd, 2009 at 12:41 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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