|
-
Jun 9th, 2006, 09:44 AM
#1
Thread Starter
Lively Member
creating ten uniquely named objects
I want to create ten objects within a loop, each object obviously should have a unique name
I am creating ten instances of TestObject
Code:
for (int i = 0; i < 10; i++)
{
TestObj UNIQUENAME = new TestObj();
}
how do i create a unique name using the loop counter i eg TestObj1, TestObj2 etc
-
Jun 9th, 2006, 09:56 AM
#2
Re: creating ten uniquely named objects
Create an array of objects, so that you don't need a name, but an ordinal reference to the object's position in the array.
-
Jun 9th, 2006, 11:47 AM
#3
Fanatic Member
Re: creating ten uniquely named objects
 Originally Posted by mendhak
Create an array of objects, so that you don't need a name, but an ordinal reference to the object's position in the array.
I'd do something like that too.
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
|