我可以在派生类中记录虚拟成员而不覆盖它吗?

时间:2016-12-31 13:45:11

标签: c++ doxygen

假设我有一些带有未记录基类的外部库:

class Base {
public:
    virtual void func() { /* something */ }
}

在我的库中,我想从这个类派生,并记录所有成员:

class Derived : public Base {
    /*!
        @brief do a thing
    */
    void other_func();

    /*!
        @brief do the base thing and another thing
    */
    void func(int arg);

    /*!
        @brief do the baseclass thing

        Also, guarantee some extra invariants XYZ that the baseclass
        does, but does not require subclassers to do.
    */
    using Base::func;
    // virtual void func() override;
    // don't want to declare a new implementation of func() here
    // so how can I attach a docstring to func() such that doxygen picks up on it?
}

如何在Base::func中记录继承的Derived.h

1 个答案:

答案 0 :(得分:3)

使用@fn标记。您使用该标记并指定函数签名,然后该块的其余部分将分配给该函数。

抱歉,我会举一个例子,但是在电话上。

我会链接到官方文档,但令人沮丧,有点讽刺的是,doxygen的参考网站不适用于移动设备。所以只需谷歌吧。