iPhone Developer Help

Full Version: Public instance variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
To create public instance variables in the .h add a line @public and enter all public fields afterwards.

@public
NSString *str;
But why we use public instance variables in classes?
You are correct, it's best not to. It's better to create an @property and create getters and setters for a private instance variable.

I just posted as a reminder to myself how to create public instance methods and just happened to use a variable.

raju Wrote:
But why we use public instance variables in classes?

Thanks felixk......dont mind ya.....its my doubt...
Reference URL's