Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 我可以在派生类中记录虚拟成员而不重写它吗?_C++_Doxygen - Fatal编程技术网

C++ 我可以在派生类中记录虚拟成员而不重写它吗?

C++ 我可以在派生类中记录虚拟成员而不重写它吗?,c++,doxygen,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

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

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?
}

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

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

对不起,我想举个例子,但在电话里


我会链接到官方文档,但令人沮丧的是,有点讽刺的是,doxygen的参考网站在手机上不起作用。当然,你可以添加一条注释,但是虚拟成员函数的全部思想是,如果你不重写它,你就不必声明它们。如果您的新类没有覆盖它,那么为什么您应该有/需要一个docstring呢?它做的事情与基类做的事情相同——希望已经有文档记录了?如果没有,请添加文档,并将补丁作为反馈发布给原始供应商/作者@MatsPetersson:问题是它还没有被记录在外部基类中,所以为了清晰起见,我想在我的库中添加文档,这将由doxygen负责。另外,派生的::func可能会遇到一些额外的不变量,我想记录这些不变量-
Base::func
碰巧已经遇到了这些不变量,所以不需要重新实现。不幸的是,我的实际情况与此不符-我继承的名称过载,所有使用
\fn func()
的尝试都只是将文档添加到
func(int)
。我更新了我的问题以反映这一点