//Temp1App.cs
using System;
struct Celsius
{
public Celsius(float temp)  //有参构造方法
{
this.temp=temp;
}
public static implicit operator Celsius(float temp)  //类型隐式转换
{
Celsius c;
c=new Celsius(temp);
return (c);
}
public static implicit operator float(Celsius c)  //类型隐式转换
{
return((((c.temp-32)/9)*5));
}
public float temp;
}
struct Fahrenheit
{
public Fahrenheit(float temp)  //有参构造方法  //3
{
this.temp=temp;
}
public static implicit operator Fahrenheit(float temp)  //类型隐式转换   //1
{
Fahrenheit f;
f=new Fahrenheit(temp);   //2
return (f);//4
}
public static implicit operator float(Fahrenheit f)  //5
{   //当t=98.6时
return ((((f.temp*9)/5)+32));
}
public float temp;
}
class Temp1App
{
public static void Main()
{
float t;
t=98.6f;
Console.Write("Conversion of {0} to Celsius=",t);
Console.WriteLine((Celsius)t);   //

//当t=98.6时,为什么执行完第4步后,要执行第5步??
t=0f;
Console.Write("Conversion of {0} to Fahrenheit=",t);
Console.WriteLine((Fahrenheit)t);
}
}