ios对象中的变量理解
作者:
谁知高枕无忧 | 来源:发表于
2018-03-06 10:35 被阅读0次//ViewController.h
@interface ViewController : UIViewController {
//a是成员变量,相当于java中的protected,可以被子类继承。不常用 兼容早期的写法
NSInteger a;
}
//b相当于java中的public,既可以被子类继承,也可以被外部访问。常用
@property (nonatomic,assign) NSInteger b;
@end
//ViewController.m
@interface ProductsViewController () {
//private 不常用 兼容早期的写法
NSInteger c;
}
//private , d can get by self. 常用
@property (nonatomic,assign) NSInteger d;
@end
本文标题:ios对象中的变量理解
本文链接:https://www.haomeiwen.com/subject/mujlfftx.html
网友评论