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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -