如何在ns3中继承类的SimpleRefCount子类(网络模拟器3)

时间:2015-03-30 05:49:18

标签: c++ inheritance ns-3

在网络模拟器3中,我想创建一个Ptr< RoutingTable>宾语。但是,编译器返回如下:

./ns3/ptr.h:457:7: error: 'class ns3::dsdv::RoutingTable' has no member named 'Unref'
    m_ptr->Unref();

我搜索过ns3的doxygen,我现在明白我应该继承SimpleRefCount,它为类提供Ref和Unref方法。为了帮助我,我查看了继承自SimpleRefCount<的OutputStreamWrapper类。 OutputStreamWrapper>。我对泛型类型有一些了解。但是,我不能为我的生活看到实际继承发生的地方。我找不到OutputStreamWrapper和它的SimpleRefCount父级之间的链接。

非常感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

如果你看source

27 namespace ns3 {
28 
70 class OutputStreamWrapper : public SimpleRefCount<OutputStreamWrapper>
//                             ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
//                                  right here

如果那是你要问的问题。