我可以使用枚举作为参数而不包括定义它的标头吗?

时间:2013-08-02 19:44:25

标签: c++ header enums

我班级中的一个函数将枚举作为参数:

// Foobar.h
class Foobar
{
    void baz(OtherClass::OtherEnum otherEnum);
}

通常为了让这个类进行编译,我必须包含OtherClass的标题。

#include "OtherClass.h"

然而,OtherClass碰巧真的很大,我不想将它包含在Foobar的标题中,否则会污染使用{{1}的其他所有内容的编译单元}。

是否仍然可以将Foobar作为参数传递而不包括OtherEnum

0 个答案:

没有答案
相关问题