0
;
"use strict";
function IPoint() {

  this.getDistance = function(point) {
    var x = this.x - point.x;
    var y = this.y - point.y;
    return Math.sqrt(x * x + y * y);
  };

  this.isAbove = function(point) {
    if (this.y <= point.y) {
      return true;
    } else {
      return false;
    }
  };
  this.isBelow = function(point) {
    if (this.y >= point.y) {
      return true;
    } else {
      return false;
    }
  };
  this.isLeftOf = function(point) {
    if (this.x <= point.x) {
      return true;
    } else {
      return false;
    }
  };
  this.isRightOf = function(point) {
    if (this.x >= point.x) {
      return true;
    } else {
      return false;
    }
  };
};

var Point = function(x, y) {
  this.x = x;
  this.y = y;
  IPoint.call(this);
};
Point.prototype =
  Object.create(null,
                {
                  get x() {
                    return this._x;
                  },
                  set x(v) {
                    this._x = v;
                  },
                  get y() {
                    return this._y;
                  },
                  set y(v) {
                    this._y = v;
                  },
                });

Uncaught TypeError: Property description must be an object: undefined geometry.js:47 (anonymous function)というエラーが表示されます。これにより、dot.create で渡すオブジェクトでセッターとゲッターを使用できないという印象を受けますが、その理由はわかりません。私は何を間違っていますか?

4

1 に答える 1