1 function Human(name, sex) {
2 this.name = name;
3 this.sex = sex;
4 if (typeof this.say != "function") {
5 Human.prototype.say = function () {
6 alert(this.name);
7 }
8 }
9 }
10 var man =new Human ("凯撒", "男");
11 man.say();