CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 1999
    Location
    Prague, Czech Republic
    Posts
    263

    ATL and Object Model (How to create a collection class)

    In my ATL (DLL) project I want to create a collection class, that can be used in VB for example. The "Item Class" (let's call it 'car') has a property 'MaxSpeed'. The Collection Class (lets call it 'cars') has got an Add, Remove, Item (default) Method plus a count Property. VB Code to enumerate the class can look like this

    Dim objCar as Car
    Dim objCars as Cars
    for each objCar in objCars
    Debug.print objCar.MaxSpeed
    next objCar



    or like this

    Dim objCar as Car
    Dim objCars as Cars
    Dim x as long
    for x = 1 to objCars.count
    Debug.print objCars(x).MaxSpeed
    next x




    I'm new to C++ and can't figure out how to do this. Where do I store internally the Collection? Does there a sample exist somewhere.

    Lots of thanks,



    Best wishes,

    Matthias Steinbart

  2. #2
    Join Date
    Aug 1999
    Location
    Flagstaff, Arizona, USA
    Posts
    5

    Re: ATL and Object Model (How to create a collection class)

    So you want that code to be converted to C++ code? Or did I totally miss what your asking?

    Please clarify a bit.

    Kevin


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