#include "stdafx.h"
using namespace System;
class MyClass
{
public:
MyClass()
{
Console::WriteLine("MyClass: Field constructor.");
}
};
ref class MyClass2
{
public:
MyClass2()
{
Console::WriteLine("MyClass2: Field constructor.");
}
};
class MyBaseClass
{
public:
MyBaseClass()
{
Console::WriteLine("MyBaseClass: Base class constructor.");
}
};
class NativeDerived : MyBaseClass
{
MyClass field;
public:
NativeDerived() : field()
{
Console::WriteLine("Native: Derived class constructor.");
}
};
ref class ManagedBase
{
public:
ManagedBase()
{
Console::WriteLine("ManagedBase: Base class constructor.");
}
};
ref class ManagedDerived : ManagedBase
{
MyClass2 field;
public:
ManagedDerived() : field()
{
Console::WriteLine("ManagedDerived: Derived class constructor.");
}
};
int main()
{
NativeDerived nd;
ManagedDerived md;
}
|