Need help on creating a custom object

I'm not familiar with class. I want to creat a MAP object like following,

map.lines(3).points(5).x  'means the X coordinate for the 5th point of the 3rd line of the map

map.lines(3).points(5).y  'means the Y coordinate for the 5th point of the 3rd line of the map

map.lines(1).color  'means the 1st line's color

Could anyone can help me to creat it?

Thanks a lot!
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

marconovaroConnect With a Mentor Commented:

You'll have to create a class Point, with a property X and Y:

property get X() as long
    X = m_myX
end property

property let X(value as long)
    m_myX = value
end property

Then, you create a class line, that contains a collection of points:

private m_PointsColl as Collection

Private Sub Class_Initialize()
   set m_PointsColl = new Collection
End Sub

Private Sub Class_Terminate()
   set m_PointsColl = Nothing
End Sub

property Get Points( itemNum as long ) as cPoint
   set Points = PointsColl(itemNum)
end property

then, you can create your map, that contains a collection of lines.

JerryleoAuthor Commented:
Thank you very much indeed for your kind help
All Courses

From novice to tech pro — start learning today.