In swift,is it a global variable or property? -


global variables variables defined outside of function, method, closure, or type context.《the swift programming guide》。

so question:

class dog {     var name: string?     func run(){      } } 

name global variable or property?

@implementation dog{   nsstring *name; - (void)run{      } } 

name global variable or property?

since class type, name property in swift example.

in objective-c example, name global variable since properties defined in @interface scope , requires @property declaration. (instance variables don't require declaration have inside block inside @interface or @implementation scopes.)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -