var CAR = function(name, color)//构造函数
        {
            var lunzi = 4;//私有的属性 var定义的就是私有
            //实例化属性/方法/函数(公开的属性/方法/函数)
            this.name = name;
            this.color = color;
            //this.lunzi = lunzi;
            
            var abc = function()//私有的方法 var定义的就是私有
            {
                alert("我是私有的方法");
            }
            
            this.say = function()
            {
                abc();
                alert("我是一辆" + this.color + "的" + this.name + "车,我有" + lunzi + "个轮子");
            }
        };

 

posted on 2016-07-18 17:50  菜霸  阅读(249)  评论(0编辑  收藏  举报