J
J S
I'm writing a "Town" class and I'm trying to figure out the correct way to
write it. I have a private array of "Building" objects in the "Town" class.
I have written a Get and Set procedure to access the array and they work
fine.
The following is a partially defination of the Class Town.
----------------------------------------------------------
Private pBuildings()
----------------------------------------------------------
Public Property Get Buildings(ByVal Index As Integer) As Building
Set Buildings = pBuildings(Index)
End Property
----------------------------------------------------------
Public Property Set Buildings(ByVal Index As Integer, ByVal Value As
Building)
Set pBuildings(Index) = Value
End Property
----------------------------------------------------------
Now I'm running into a problem using the following syntax
UBound(iTown.Buildings) --Which should return the Ubound of the Private
pBuildings array.
Where iTown is a Town Object and I am trying to figure out how many
buildings I
have in the town.
The error message says something like "argument not optional". Which I
assume is caused by the fact the property GET procedure is looking for a
index variable. I want to find a way to write the class so that my code does
not need to change and Ubound(iTown.Buildings) syntax continues to work.
I was thinking along the lines of trying to figure out how to overload the
property GET procedure with something like this
write it. I have a private array of "Building" objects in the "Town" class.
I have written a Get and Set procedure to access the array and they work
fine.
The following is a partially defination of the Class Town.
----------------------------------------------------------
Private pBuildings()
----------------------------------------------------------
Public Property Get Buildings(ByVal Index As Integer) As Building
Set Buildings = pBuildings(Index)
End Property
----------------------------------------------------------
Public Property Set Buildings(ByVal Index As Integer, ByVal Value As
Building)
Set pBuildings(Index) = Value
End Property
----------------------------------------------------------
Now I'm running into a problem using the following syntax
UBound(iTown.Buildings) --Which should return the Ubound of the Private
pBuildings array.
Where iTown is a Town Object and I am trying to figure out how many
buildings I
have in the town.
The error message says something like "argument not optional". Which I
assume is caused by the fact the property GET procedure is looking for a
index variable. I want to find a way to write the class so that my code does
not need to change and Ubound(iTown.Buildings) syntax continues to work.
I was thinking along the lines of trying to figure out how to overload the
property GET procedure with something like this