• 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: where have all the IVARS gone? (long time passing...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: where have all the IVARS gone? (long time passing...)


  • Subject: Re: where have all the IVARS gone? (long time passing...)
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 9 Jul 2006 23:37:51 -0700


On Jul 9, 2006, at 10:53 PM, Vinay Prabhu wrote:

The '< >' symbols I have used to point the class name,

the actual code looks like this,

@interface myClass (Private)
//Private variables
int iVar1;
float iVar2;

These are now declared as global variables and there will be exactly one "instance" of each available throughout your entire program. Instantiate more than one instance of [the incorrectly named] "myClass" class, and all instances will see the exact same values and storage location of said variables.



//Private methods
- (void)doSomething;
@end

This works perfectly fine, because I have used the same approach to hide the
private variables in a static library created by me. Where I need to expose
the .h file.
The static library is up and used in other application without any problems.
Successfully hiding the private variables.

The only way this would "work" is if you are only ever instantiating exactly one instance of "myClass". In that case, it would appear to work until you did something like...


   iVar1 = 42;

... in any random source file in your application.

b.bum

_______________________________________________
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


  • Follow-Ups:
    • RE: where have all the IVARS gone? (long time passing...)
      • From: Vinay Prabhu <email@hidden>
References: 
 >RE: where have all the IVARS gone? (long time passing...) (From: Vinay Prabhu <email@hidden>)

  • Prev by Date: Re: question about -init methods
  • Next by Date: Re: question about -init methods
  • Previous by thread: Re: where have all the IVARS gone? (long time passing...)
  • Next by thread: RE: where have all the IVARS gone? (long time passing...)
  • Index(es):
    • Date
    • Thread