概述
¥Overview
@override
标记表示某个符号覆盖父类中同名的符号。
¥The @override
tag indicates that a symbol overrides a symbol with the same name in a parent class.
提供此标签是为了与 闭包编译器 兼容。默认情况下,JSDoc 自动识别覆盖父级的符号。
¥This tag is provided for compatibility with Closure Compiler. By default, JSDoc automatically identifies symbols that override a parent.
如果你的 JSDoc 注释包含 @inheritdoc
标签,则不需要包含 @override
标签。@inheritdoc
标签的存在意味着 @override
标签的存在。
¥If your JSDoc comment includes the @inheritdoc
tag, you do not need to include
the @override
tag. The presence of the @inheritdoc
tag implies the presence of the @override
tag.
示例
¥Example
以下示例显示如何指示某个方法重写其父类中的方法:
¥The following example shows how to indicate that a method overrides a method in 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() {}
/**
* Open the socket.
* @override
*/
Socket.prototype.open = function() {
// ...
};