#include "stdafx.h"
using namespace System;
ref class Base {};
ref class Derived : Base {} ;
int main(){
Base^ b = gcnew Base();
Derived^ d = gcnew Derived();
try
{
d = safe_cast(b);
}
catch (InvalidCastException^ e)
{
}
d = dynamic_cast(b);
if (d == nullptr)
{
}
}