C#类中显示与隐匿转换操作符同时只能实现一个
// 显示转换操作符
static public explicit operator Salary(int n)
{
Salary s = new Salary(n);
return s;
}
// 隐式转换操作符
static public implicit operator Salary(int n)
{
Salary s = new Salary(n);
return s;
}
Salary s1 = 100; // 隐匿转换
Salary s2 = (Salary)100; //显示转换