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

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -