加载中...

@abstract


这个成员必须在继承类中实现(或重写)。

别名: @virtual

Overview(概述)

该成员(一般指父类的方法)必须在继承的子类中实现(或重写)。

Example (例子)

例如,父类的抽象方法,子类实现该方法:

  1. /**
  2. * Generic dairy product.
  3. * @constructor
  4. */
  5. function DairyProduct() {}
  6. /**
  7. * Check whether the dairy product is solid at room temperature.
  8. * @abstract
  9. * @return {boolean}
  10. */
  11. DairyProduct.prototype.isSolid = function() {
  12. throw new Error('must be implemented by subclass!');
  13. };
  14. /**
  15. * Cool, refreshing milk.
  16. * @constructor
  17. * @augments DairyProduct
  18. */
  19. function Milk() {}
  20. /**
  21. * Check whether milk is solid at room temperature.
  22. * @return {boolean} Always returns false.
  23. */
  24. Milk.prototype.isSolid = function() {
  25. return false;
  26. };

还没有评论.