@override

.. @override::
语法

@override

概述

The @override tag indicates that a symbol overrides a symbol with the same name in a parent class.

This tag is provided for compatibility with Closure Compiler. By default, JSDoc automatically identifies symbols that override a parent.

If your JSDoc comment includes the @inheritdoc, you do not need to include the @override tag. The presence of the @inheritdoc tag implies the presence of the @override tag.

示例

以下示例显示如何指示方法覆盖其父类中的方法:

Method that overrides a parent
/**
 * @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() {
    // ...
};