public ref class Point : ICloneable
{
// ...
public:
virtual Object^ Clone()
{
return MemberwiseClone();
}
};
int main()
{
/*1*/ Point^ p1 = gcnew Point(3, 5);
/*2*/ Console::WriteLine("p1: {0}", p1);
/*3*/ Point^ p2 = static_cast<Point^>(p1->Clone());
/*4*/ p1->Move(9, 11);
/*5*/ Console::WriteLine("p1: {0}", p1);
/*6*/ Console::WriteLine("p2: {0}", p2);
}