A
aleko
Hi,
I am trying to wrap some std C++ code so it can be used from C#. The
problem I'm having is that I can't seem to derive a ref class from a C+
+ interface. Compilation fails with C2811: "...can only inherit from a
ref class or interface class". AFAIK an abstract struct constitutes a
valid interface.
Here's an example:
// std C++
namespace blah
{
struct IThing
{
virtual ~IThing() {}
virtual void doIt() = 0;
};
class Thing : public IThing
{
public:
Thing() {}
virtual ~Thing() {}
void doIt() {}
};
} // namespace
// C++/CLI
namespace Blah
{
ref class Thing : public blah::IThing // C2811
{
};
}
Replacing the structs with __interfaces didn't help. Any ideas?
Thanks,
Aleko
I am trying to wrap some std C++ code so it can be used from C#. The
problem I'm having is that I can't seem to derive a ref class from a C+
+ interface. Compilation fails with C2811: "...can only inherit from a
ref class or interface class". AFAIK an abstract struct constitutes a
valid interface.
Here's an example:
// std C++
namespace blah
{
struct IThing
{
virtual ~IThing() {}
virtual void doIt() = 0;
};
class Thing : public IThing
{
public:
Thing() {}
virtual ~Thing() {}
void doIt() {}
};
} // namespace
// C++/CLI
namespace Blah
{
ref class Thing : public blah::IThing // C2811
{
};
}
Replacing the structs with __interfaces didn't help. Any ideas?
Thanks,
Aleko