PDA

View Full Version : Simple Object Interaction Question




tjhopkins224
Mar 27, 2008, 04:08 PM
What is the best way to handle this simple problem in Obj-C?

ObjectA creates an instance of ObjectB and is free to get and set properties of ObjectB. How can ObjectB similarly reference and send messages back to ObjectA (other than returning data from methods specifically called by Object A)?

Thanks for your time.



lee1210
Mar 27, 2008, 04:24 PM
Have a constructor for ObjectB that takes a pointer to the type of ObjectA, and have ObjectA pass in self when it instantiates ObjectB?

-Lee

tjhopkins224
Mar 27, 2008, 05:35 PM
Got it -- thanks for your help.