unsigned char *check = NULL;
check = (dynamic_cast<unsigned char *>( ns3::NetDevice::GetChannel() ));
这是我正在尝试的。但是出现了错误:
error: cannot dynamic_cast ‘ns3::NetDevice::GetChannel() const()’ (of type ‘class ns3::Ptr<ns3::Channel>’) to type ‘unsigned char*’ (target is not pointer or reference to class)
我还尝试过:
reinterpret_cast
但它根本不起作用。
reinterpret_cast
应该可以工作。 - sth代码
virtual Ptr<Channel> GetChannel(void) const = 0 - Khizar AliPtr
是什么?如果没有定义,我们只能猜测如何将其转换为原始指针。 - Mike Seymour