Difference in variable declarations - objective c -


my question conceptual - difference between following 2 snippets of code?

1)

@implementation person  {     nsstring *name; // other variables }   - (void) somemethod  @end 

2)

@implementation person  nsstring *name; //other variables  - (void) somemethod  @end 

the reason ask able compile code followed format #2 not format #1, , curious difference between two.

the first declares instance variable. name belongs person object.

the second declare global variable.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -