How would I define a collection as a property of a class?
How would I define a collection as a property of a class?
I just posted and I think the post is lost so here goes again:
I am trying to create an polygon area as a class. As part of the definition
of each instance of the area is the collection of points defining corners
around its perimeter. The number of sides is equal to the number of corners.
I also created a class called PolyPoint with the properties of the
coordinates of a point.
I am trying to add a collection of PolyPoints to each instance of the area
class.
"Jim Thomlinson" wrote:
> You have me a little lost here. A collection is not really a property but
> more of a container for objects. So what do you mean by a perperty. Do you
> mean the prperties of the objects within the collection? You can make the
> collection accessible as a part fo teh class by just declaring it public kind
> of like this
>
> CLASS
> Option Explicit
>
> Public col As Collection
>
> Private Sub Class_Initialize()
> Set col = New Collection
> End Sub
>
> MODULE
> Sub test()
> Dim var As Class1
>
> Set var = New Class1
>
> var.col.Add Sheet1, Sheet1.Name
> End Sub
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Cody" wrote:
>
> > How would I define a collection as a property of a class?
You have me a little lost here. A collection is not really a property but
more of a container for objects. So what do you mean by a perperty. Do you
mean the prperties of the objects within the collection? You can make the
collection accessible as a part fo teh class by just declaring it public kind
of like this
CLASS
Option Explicit
Public col As Collection
Private Sub Class_Initialize()
Set col = New Collection
End Sub
MODULE
Sub test()
Dim var As Class1
Set var = New Class1
var.col.Add Sheet1, Sheet1.Name
End Sub
--
HTH...
Jim Thomlinson
"Cody" wrote:
> How would I define a collection as a property of a class?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks