1
说我有一个未公开的基类的一些外部库:我可以在派生类中记录虚拟成员而不重写它吗?
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
?
当然,您可以添加评论,但虚拟成员函数的整体思想是,如果您不覆盖它,则不必声明它们。如果你的新类没有覆盖它,那么为什么你需要/需要一个文档字符串呢?它和基类做的事情是一样的 - 它希望被记录下来?如果没有,请添加文档,并将补丁发布为原始供应商/作者的反馈! –
@MatsPetersson:问题是它没有被记录在外部基类中,所以我想在清单中添加文档,这将被doxygen拾取。此外,还有一些Derived :: func预期会遇到的额外不变量,我想要记录 - 它恰好恰好符合这些'Base :: func',因此不需要重新实现 – Eric