var Graduate, Student, graduate, student,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
Student = (function() {
function Student(name, score, gender) {
this.name = name;
this.score = score;
this.gender = gender;
}
Student.prototype.speak = function(word) {
return console.log("Hello, " + word);
};
return Student;
})();
Graduate = (function(superClass) {
extend(Graduate, superClass);
function Graduate() {
return Graduate.__super__.constructor.apply(this, arguments);
}
Graduate.prototype.congratulations = function() {
return console.log(this.name + " graduate");
};
return Graduate;
})(Student);
student = new Student('Andy', 100, 'male');
student.speak("CoffeeScript");
graduate = new Graduate('Candy', 97, 'female');
graduate.congratulations();