标签:
(function(){...}());
JS CODE:
(function(){
var n = "ime";
function People(name){
this._name = name;
}
People.prototype.say = function(){
alert("peo-hello"+this._name+n);
}
window.People = People;
}());
(function(){
var n = "foo";
function Student(name){
this._name = name;
}
Student.prototype = new People();
var superSsay = Student.prototype.say;
Student.prototype.say = function(){
superSsay.call(this);
alert("stu-hello"+this._name+n);
}
window.Student = Student;
}());
var s = new Student("iwen");
s.say();
标签:
原文地址:http://www.cnblogs.com/htmlphp/p/4815511.html