//使用模块
template = {};
template.createObj = (function(){
//私有成员
var _age = "";
var _name = "";
//公有访问方法
return{
//设置器
setAge:function(age){
this._age = age;
},
setName:function(age){
this._name = age;
},
getAge:function(age){
return this._age;
},
getName:function(age){
return this._name;
},
print:function(){
console.log(this.getName() + ":" + this.getAge());
}
}
});
var wzg = template.createObj();
wzg.setName("吴志刚");
//wzg.setAge("24");
wzg.print();