class Point
{
public int X;
public int Y;
public static implicit operator double(Point RValue)
{
double Distance;
double Sum;
Sum = (RValue.X * RValue.X) + (RValue.Y * RValue.Y);
Distance = System.Math.Sqrt(Sum);
return Distance;
}
public static void Main()
{
double Distance;
Point MyPoint = new Point();
MyPoint.X = 100;
MyPoint.Y = 200;
Distance = MyPoint;
System.Console.WriteLine(Distance);
}
}
|