views:

88

answers:

2

I have a .NET_4 Managed C++ ref class that I derive from a .NET_4 base class written in C#.

EXAMPLE::
{
C# BASE CLASS::
namespace Core
{
  public class ResourceManager
  {
    public class _Resource
    {
      public virtual void Delete() {}
    }
  }
}
}

MANAGED C++ CLASS
namspace Input.DI
{
  public ref class Mouse : ResourceManager::_Resource
  {
    public:
    virtual void Delete() {}
  };
}

Here is the Error i'm getting:: { 'Input::DI::Mouse::Delete' : matches base ref class method 'Core::ResourceManager::_Resource::Delete', but is not marked 'new' or 'override'; 'new' (and 'virtual') is assumed }

Anyone know what the correct managed c++ syntax is to override a virtual function from a c# class??

A: 

You put override after the function signature.

//MANAGED C++ CLASS
namspace Input.DI
{
  public ref class Mouse : ResourceManager::_Resource
  {
    public:
    virtual void Delete() override {}
  };
}
Igor Zevaka
A: 

Awww I must be tired... Just a had a O dur moment here a second after I posted lol.

This answer is:: "virtual void Delete() override;" So you just tag override at the end of the virtual function... easy.

zezba9000