#include "stdafx.h"
class MyBaseClass
{
public:
MyBaseClass()
{
myvirtual();
}
virtual void myvirtual()
{
System::Console::WriteLine("MyBaseClass::myvirtual");
}
};
class NativeDerived : public MyBaseClass
{
public:
NativeDerived()
{
myvirtual();
}
virtual void myvirtual()
{
System::Console::WriteLine("NativeDerived::myvirtual");
}
};
ref class ManagedBase
{
public:
ManagedBase()
{
myvirtual();
}
virtual void myvirtual()
{
System::Console::WriteLine("ManagedBase::myvirtual");
}
};
ref class ManagedDerived : ManagedBase
{
public:
ManagedDerived()
{
myvirtual();
}
virtual void myvirtual() override
{
System::Console::WriteLine("ManagedDerived::myvirtual");
}
};
int main()
{
NativeDerived nd;
ManagedDerived rd;
}
|