• 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: Help with my stream object please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with my stream object please


  • Subject: Re: Help with my stream object please
  • From: Andy Lee <email@hidden>
  • Date: Mon, 10 Oct 2005 12:05:26 -0400

On Oct 10, 2005, at 11:44 AM, Mark Williams wrote:
The downloader class is actually about 10 pages long printed so it's too big to post here.
I have a questions. Ok I did not declare most of my variables in the header file. I declared them at the top of the class file before the @implementation line. Is this why they are being shared between instances?

Yes. You didn't declare them as instance variables, but as top-level variables (the technical term for which eludes me -- global?).


Each instance has its own storage for instance variables and does not share it with other instances. That's why they're called instance variables. When a method refers to instance variables, its referring to the storage allocated for the particular instance that is executing the method at the time.

The variables you declared occupy one location in memory for the duration of the application. There is only "one of them." Your methods can refer to them, but they are all referring to the same thing.

--Andy


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Help with my stream object please (From: Mark Williams <email@hidden>)
 >Re: Help with my stream object please (From: Cameron Hayne <email@hidden>)
 >Re: Help with my stream object please (From: Mark Williams <email@hidden>)

  • Prev by Date: Re: Help with my stream object please
  • Next by Date: Interface Builder and Window Size Limits
  • Previous by thread: Re: Help with my stream object please
  • Next by thread: Re: Help with my stream object please {Solved}
  • Index(es):
    • Date
    • Thread