JSDoc 中文网

Synonyms

概述

¥Overview

@abstract 标记标识必须由继承该成员的对象实现(或覆盖)的成员。

¥The @abstract tag identifies members that must be implemented (or overridden) by objects that inherit the member.

示例

¥Example

父类有抽象方法,子类实现该方法
/**

 * 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;
};