|
-
January 13th, 2000, 05:50 PM
#1
Collections,Objects and Types
1. Can a collection hold 2 different classes? The object wizard in VB6 allows me to put one class into the collection, but not more. I may be doing something wrong.
2. Types. Is this a valid Type definition :-
Type Player
'Stores all the player information
Units(0 to 999) as clsBattleGroup
'array of players battlegroups
'up to 1000 per player
Facilities(1 to 300) as clsFacility
'array of players facilities
'up to 300 per player
AreaScouted as VisibleMap
AreaCurrentlyVisible as VisibleMap
End Type
To be accessed : let Player.units(Index).MovementRate =5
last but not least, can an object property be a multidimensional array and if so how do the Let and Get methods work? (msdn doesn't give an example I can find)?
Thanks in advance.
They said 'Jump!'.
I said 'How high?'
They said 'We don't know, just jump.'
-
January 14th, 2000, 02:47 AM
#2
Re: Collections,Objects and Types
>Can a collection hold 2 different classes?
kind of; it can hold two instances of objects of different classes.
Dim col as new Collection
col.Add me
col.Add Command1
..adds a Form object and a CommandButtonObject to the collection
>Is this a valid Type definition
Yes it is (assuming that clsBattleGroup ... are correctly defined classes)
>can an object property be a multidimensional array and if so how do the Let and Get methods work? (msdn doesn't give an example I can find)?
here is a sample:
in your class module
option Explicit
Dim arr(0 to 20, 0 to 10) as Integer
public property let theValue(byval i as Integer, byval j as Integer, byval val as Integer)
arr(i, j) = val
End property
in the calling module
Dim x as new Class1
x.theValue(1, 2) = 5
-
April 11th, 2000, 08:18 AM
#3
Re: Collections,Objects and Types
I would be curious to see the new object added to the collection with the array
and the retrieval of the value.
To add the object to the collection we would:
col.Add X
How would the value 5 be returned from this collection?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|