function User(properties){
for(var p in properties) {
(function(which){
which["get" + p] = function(){
return properties[p];
};
which["set" + p] = function(val){
properties[p] = val;
};
})(this);
}
}
var user = new User({"name":"tom","age":"444"});
alert(user.name);
alert(user.getname());
user.setage(222);
alert(user.getage());

]]>