• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: object instance names generated on the fly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object instance names generated on the fly?


  • Subject: Re: object instance names generated on the fly?
  • From: Ben Dougall <email@hidden>
  • Date: Fri, 21 Mar 2003 22:02:48 +0000

not way off, but yeah, a bit off. not the names of variables, but the names of objects - in a variable fashion.

myObject0
myObject1
myObject2
...

different instances of the same object but using names that have been derived on the fly, and on the fly requires variables.


On Friday, March 21, 2003, at 04:20 pm, email@hidden wrote:

But, I'm not sure I understand....

is this what you are talking about?

for(int i = 0; i < 0; ++i) {
MyType myVariable + i = whatever;
}

and then use it as
myVariable0
myVariable1
...

because if that is what you want you can just create an array and access
the elements as
myVariable[0]
myVariable[1]
...

Or am I way off the mark here?

John.




Ben Dougall <email@hidden>
Sent by: email@hidden
03/21/2003 03:48 PM


To: email@hidden
cc: email@hidden
Subject: Re: object instance names generated on the fly?


thanks for the reply.

because an array will behave in a very different way to my object. i
want to initiate this object many times, so i guess the precise
question is: is it possible to initiate an object with a name that's a
variable? rather than what seems to be the norm - with a name that
you've typed in the code.


On Friday, March 21, 2003, at 03:14 pm, email@hidden
wrote:

Why don't you just use an array? or a dictionary if you really have to
give each instance a name...

John.




Ben Dougall <email@hidden>
Sent by: email@hidden
03/21/2003 10:49 AM


To: email@hidden
cc:
Subject: object instance names generated on the fly?


only just starting cocoa/obj-c so this might be very easy to do, or
impossible. i have no idea.

is it possible to get various object instances from one class with
names based/generated from a variable rather than names that have been
typed into the code - so a series of object instances whos names have
been generated by using a for loop for instance?

thanks.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: object instance names generated on the fly?
      • From: Ben Dougall <email@hidden>
  • Prev by Date: Re: object instance names generated on the fly?
  • Next by Date: Re: object instance names generated on the fly?
  • Previous by thread: Re: object instance names generated on the fly?
  • Next by thread: Re: object instance names generated on the fly?
  • Index(es):
    • Date
    • Thread