Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing pointers



On Monday, December 30, 2002, at 06:17 AM, Aaron Boothello wrote:

the objects are both declared as pointers.

the first one (obj1 is allocated the memory and initialized.
the second one is NOT allocated any memory, but instead im implementing the declaration and implementation as you have outlined below.

when i call the method/function(im not sure what to call it at this point), i do the following...
obj2 = [outlet getObject:self]

so now, obj2 should be pointing to the same object, correct.

alright, now for another question....
lets say i have two separate front ends(views) for each of these objects.... and both views accept input that change the object..... so, the information displayed on both vies should be the same at all times regardless of where the information is being altered. correct ?
Thanks.

If i understand what you are trying to do, you are making things way too complicated. You have an object, Obj_A points to that object (i.e. Obj_A is an id type variable). You want to have another id type variable Obj_A_Too point to Obj_A as well. You can just do this: (I just chose NSObject to makes things simpler).

id Obj_A = [[NSObject alloc] init];
id Obj_A_Too = Obj_A;

Roarke Lynch
-------------------------------
email@hidden
_______________________________________________
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.

References: 
 >Re: passing pointers (From: Aaron Boothello <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.