A
A n g l e r
Hello everybody. I've got a bizarre problem concerning inheritance of
the managed c++ code when using templates. Consider the following
wrapper for the unmanaged c++ class:
template <typename SomeType>
public ref class SomeManagedClass
{
private:
SomeType* pSomeObj;
public:
SomeManagedClass(void) { pSomeObj=new SomeType(); }
~EyeTouchProcBaseManaged(void) { SAFE_DELETE(pSomeObj); }
void Method1(void) { pSomeObj->Method1(); }
}
Now let's derive a new managed wrapper that specializes it a bit
further:
public ref class SomeManagedClassDer : public SomeManagedClass<SomeType>
{
public:
SomeManagedClassDer(void) : SomeManagedClass() { };
};
When using an object of the derived class SomeManagedClassDer in c# I
cannot access the Method1 method (according c#, it does not contain the
definition - although it's expected to be inherited). Does anyone know
why?! If the template is removed from the above example and replaced
with SomeType, suddenly the Method1 method becomes visible in c# scope.
Kind regards,
Peter.
the managed c++ code when using templates. Consider the following
wrapper for the unmanaged c++ class:
template <typename SomeType>
public ref class SomeManagedClass
{
private:
SomeType* pSomeObj;
public:
SomeManagedClass(void) { pSomeObj=new SomeType(); }
~EyeTouchProcBaseManaged(void) { SAFE_DELETE(pSomeObj); }
void Method1(void) { pSomeObj->Method1(); }
}
Now let's derive a new managed wrapper that specializes it a bit
further:
public ref class SomeManagedClassDer : public SomeManagedClass<SomeType>
{
public:
SomeManagedClassDer(void) : SomeManagedClass() { };
};
When using an object of the derived class SomeManagedClassDer in c# I
cannot access the Method1 method (according c#, it does not contain the
definition - although it's expected to be inherited). Does anyone know
why?! If the template is removed from the above example and replaced
with SomeType, suddenly the Method1 method becomes visible in c# scope.
Kind regards,
Peter.