swift set与get

2018-08-31  本文已影响0人  呵邢
//public公开的,private私有的,只有在本类中访问,internal本类和子类中访问

  private var _backGroundColor:String?
    var backGroundColor:String?{
        get{
            return _backGroundColor
        }
        set{
            _backGroundColor = newValue
        }
        
    }
    
    private var _alpha:Float?
    var alpha:Float?{
        get{
            return _alpha
        }
        set{
            _alpha = newValue
        }
        
    }
上一篇下一篇

猜你喜欢

热点阅读