Click to See Complete Forum and Search --> : ATL and Object Model (How to create a collection class)


Matthias S
August 19th, 1999, 07:37 AM
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

fred_dead
August 27th, 1999, 07:49 PM
So you want that code to be converted to C++ code? Or did I totally miss what your asking?

Please clarify a bit.

Kevin