#include "stdafx.h"
#include
#include
using namespace System;
using namespace msclr;
ref class MyClass
{
public:
void f()
{
Console::WriteLine("managed member function");
}
~MyClass()
{
Console::WriteLine("destructor");
}
};
class N
{
gcroot r_gcroot;
auto_gcroot r_auto_gcroot;
public:
N()
{
r_gcroot = gcnew MyClass();
r_gcroot->f();
r_auto_gcroot = gcnew MyClass();
r_auto_gcroot->f();
}
};
int main()
{
N n;
}