概述
¥Overview
@inheritdoc
标记指示符号应从其父类继承其文档。你在 JSDoc 注释中包含的任何其他标签都将被忽略。
¥The @inheritdoc
tag indicates that a symbol should inherit its documentation from its parent
class. Any other tags that you include in the JSDoc comment will be ignored.
提供此标签是为了与 闭包编译器 兼容。默认情况下,如果你不向符号添加 JSDoc 注释,则该符号将从其父级继承文档。
¥This tag is provided for compatibility with Closure Compiler. By default, if you do not add a JSDoc comment to a symbol, the symbol will inherit documentation from its parent.
@inheritdoc
标签的存在意味着 @override
标签 的存在。
¥The presence of the @inheritdoc
tag implies the presence of the @override
tag.
示例
¥Examples
以下示例显示类如何指示它从其父类继承文档:
¥The following example shows how a class can indicate that it inherits documentation from its parent class:
/**
* @classdesc Abstract class representing a network connection.
* @class
*/
function Connection() {}
/**
* Open the connection.
*/
Connection.prototype.open = function() {
// ...
};
/**
* @classdesc Class representing a socket connection.
* @class
* @augments Connection
*/
function Socket() {}
/** @inheritdoc */
Socket.prototype.open = function() {
// ...
};
通过省略 Socket#open
中的 JSDoc 注释,你可以获得相同的结果:
¥You can get the same result by omitting the JSDoc comment from Socket#open
:
/**
* @classdesc Abstract class representing a network connection.
* @class
*/
function Connection() {}
/**
* Open the connection.
*/
Connection.prototype.open = function() {
// ...
};
/**
* @classdesc Class representing a socket connection.
* @class
* @augments Connection
*/
function Socket() {}
Socket.prototype.open = function() {
// ...
};