访问权限

属性(4种)

    int _i0; //_i0的访问权限是保护的,默认状态

    @public
    int _i1; //_i1的访问权限是公有的,类外也可以使用

    @package
    int _i2;//_i2的访问权限是包内的(何为包内??)

    @protected//从包内转换成保护的
    int _i3;

    @private//私有的,作用域在类内,和protected在继承有区别
    int _i4;

方法(2种)

@implementation TRExample
{
    @public//在此处public不起作用
    int _i5;//私有的
}

-(void)meth{
    NSLog(@"公有");
    [self sy];
}
-(void)sy{
//在interface中没有声明直接写出方法的函数体属于私有方法
    NSLog(@"私有");
}
成功的三大原则: 1、坚持 2、不要脸 3、坚持不要脸
原文地址:https://www.cnblogs.com/xulinmei/p/7413529.html