• 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: passing pointers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing pointers


  • Subject: Re: passing pointers
  • From: Aaron Boothello <email@hidden>
  • Date: Mon, 30 Dec 2002 06:17:55 -0500

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.

On Monday, December 30, 2002, at 05:23 AM, Angela Brett wrote:

David is right about returning a pointer, you probably only need to return obj since obj is most likely a pointer to an object anyway. You'd only need to return *obj if obj is a pointer to a pointer to an object. I guess you don't want to return &obj since that would be an object ** and your method is declared as returning an object *.

Anyway, here's my contribution: you are not calling the right function. -function: as you have implemented it takes an argument, but you are calling a method -function which does not take any arguments. You should call it like this:

obj2=[outlet function:self];

but since function: does not do anything with the argument, you could get rid of it altogether, and change it to:

declaration:
- (object *) function;
implementation:
-(object *) function
{
return obj;
}
call:
obj2 = [outlet function];
_______________________________________________
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: passing pointers
      • From: Roarke Lynch <email@hidden>
References: 
 >Re: passing pointers (From: Angela Brett <email@hidden>)

  • Prev by Date: Re: passing pointers
  • Next by Date: Re: passing pointers
  • Previous by thread: Re: passing pointers
  • Next by thread: Re: passing pointers
  • Index(es):
    • Date
    • Thread