Mark overridden functions

c++, doxygen, overriding

Solution

Every overridden function automatically gets a notice it has been reimplemented. For example the overridden function in a derived class gets the notice "Reimplemented from MyBaseClass."

It also puts a notice in the documentation of the base class. There is mentions "Reimplemented in Test"

To show all functions, including the inherited functions, you can set `INLINE_INHERITED_MEMB` to `YES`. Then Doxygen copies the documentation of every inherited, but not overridden, function into the documentation of the derived class.

For example, when using this source:

class TestBase
{
    public:
        /**
         * Base class function.
         */
        virtual void function();

      /**
       * Another function.
       */
      virtual void another();
};

class Test: public TestBase
{        
    public:
        /**
         * Overridden function.
         */
        virtual void function();
};

And setting `INLINE_INHERITED_MEMB` to `YES` will result in the following documentation for the `Derived` class: (With Doxygen 1.7.6)

Member Function Documentation

`virtual void TestBase::another ( ) [virtual, inherited]` Another function.

`virtual void Test::function ( ) [virtual]` Derived. Reimplemented from TestBase.

I think this is what you are looking for.

Problem

Does a command exist, like `\deprecated`, but to mark overridden functions? Java has an annotation `@override` for functions you have overridden. I would like to do the same in C++, so that I can to see the superclass functions I've overridden. At best, the documentation page should also show all class member functions, which are inherited, but not explicitly overridden with hyper-links to the superclass functions. I know there is a way to copy the documentation from the superclass method. But I don't want to have the whole doc copied. I just want to know, that a function is inherited. The behavior should be similar to the deprecated option to mark those old functions with a bar.

Original source

Related problems