JSDoc中文文档(@use JSDoc)

JSDoc @abstract 标签

目录

同义词

JSDoc @virtual 标签

语法

@access

概述

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

示例

示例: 父类的抽象方法,子类实现该方法
/**
 * Generic dairy product.
 * @constructor
 */
function DairyProduct() {}

/**
 * Check whether the dairy product is solid at room temperature.
 * @abstract
 * @return {boolean}
 */
DairyProduct.prototype.isSolid = function() {
    throw new Error('must be implemented by subclass!');
};

/**
 * Cool, refreshing milk.
 * @constructor
 * @augments DairyProduct
 */
function Milk() {}

/**
 * Check whether milk is solid at room temperature.
 * @return {boolean} Always returns false.
 */
Milk.prototype.isSolid = function() {
    return false;
};