Im making a sim of a robocup for a project and it would really help make the code easier to read if I could have an array of players but I cant dim and array as new and my players are all a class I made called gameobject.
How do I make an array of players as my class gameobject?
Chris11246
Recommended Answers
Jump to Postyou need to initialize each player as new gameobject
Dim players(9) As gameobject For i As Integer = 0 To players.Length - 1 players(i) = New gameobject players(i).testProperty = CStr(i) Next For i As Integer = 0 To players.Length - 1 Console.WriteLine(players(i).testProperty) Next
All 4 Replies
ShemoPT 0
Newbie Poster
Chris11246
GeekByChoiCe 152
Practically a Master Poster Featured Poster
Chris11246
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.