getter setter 用法
以前只知道getter setter给类实例用,今天无意中发现,原来getter setter还可以给静态类调用。
示例:
package
{
/**
* www.litefeel.com
* lite3@qq.com
* @author lite3
*/
public class getSetTest
{
// 静态成员
static private var _myWeb:String = "www.litefeel.com";
// 非静态成员
private var _myWeb:String = "www.litefeel.com";
// 静态 getter setter
static public function get myWeb():String { return _myWeb; }
static public function set myWeb(value:String):void
{
_myWeb = value;
}
// 非静态 getter setter
public function get myWeb():String { return _myWeb; }
public function set myWeb(value:String):void
{
_myWeb = value;
}
}
}
» 转载请注明来源:www.litefeel.com » 《getter setter 用法》
» 本文链接地址:https://www.litefeel.com/use-getter-setter/
» 订阅本站:www.litefeel.com/feed/
» Host on Linode VPS
» 本文链接地址:https://www.litefeel.com/use-getter-setter/
» 订阅本站:www.litefeel.com/feed/
» Host on Linode VPS