Click here to Skip to main content
15,890,434 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a ref class to hold data in a Managed C++ DLL.

The type (Stuff::Manager) is from a 3rd party .NET DLL.

Question is in the comment in the code block.

ref class MyDataClass
{
public: 
  static Stuff::Manager^ m_Manager;
/// ...
}


With pseudo-code ...

void f()
{
  Stuff::Manager^ manager = GetManager();
  MyDataClass::m_Manager = manager; // Is this a transfer of ownership or just a copy ? or will manager be destroy by the scope ?
}

void g()
{
  MyDataClass::m_Manager->DoSomething();
}

int Main()
{
  f();
  g();
}


Thanks.

What I have tried:

I am not certain what I need to try or google to find that out.
Posted
Updated 19-Nov-17 4:10am

1 solution

manager is a pointer and since it's managed .NET code you don't have to worry about disposing it.
It will be done automatically.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900