FLEX:如果未提供构造函数参数,则为if语句

时间:2010-04-19 12:44:10

标签: actionscript-3

最好在我的costructor中使用if(source == null),仅在提供了costructor参数时运行代码?

package dataModels {

    import mx.collections.ArrayCollection;
        import dataModels.*;


    [Bindable]
    public class TagsListModel extends ArrayCollection{

        public function TagsListModel( source:Array=null ) {

            if (source!=null) {
                super(source);

            }
        }

    }
}

感谢

1 个答案:

答案 0 :(得分:0)

我不知道这是不是好习惯,但是如果它适合你,那就很好。