#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");
}
};
int main()
{
gcroot r_gcroot;
auto_gcroot r_auto_gcroot;
r_gcroot = gcnew MyClass();
r_gcroot->f();
r_auto_gcroot = gcnew MyClass();
r_auto_gcroot->f();
}