首页 > 代码库 > js 继承

js 继承

function Shape(name) {

  this.id = Utils.getUID();

  this.name = name;

}

Shape.prototype = {

  destroy: function() {},

  check: function() {}

}

function Circle() {

  Shape.call(this, ‘circle‘);

}

Circle.prototype = Object.create(Shape.prototype);

Circle.prototype.draw = function() {}

js 继承