110,556
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csharp_重载
{
class Program
{
static int a(int a1,int a2)
{
return a1-a2;
}
static short a(short b1, short b2)
{
return b1+b2;//无法将int 隐式转换为short 是什么意思 我不是定义b1 b2为short了吗 哪里来的int??
//return (short)(b1+b2);
}
static void Main(string[] args)
{
//double re= Convert.ToDouble(a(15.1,12));
double re=a(15.1,12.2);// 报错说无法double转换int 又是 哪里来的int??
Console.WriteLine(re);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csharp_重载
{
class Program
{
static int a(int a1,int a2)
{
return a1-a2;
}
static float a(float b1,float b2)
{
return b1 + b2;
//return Convert.ToDouble(b1+b2);
}
static void Main(string[] args)
{
//double re= Convert.ToDouble(a(15.1,12));
double re= Convert.ToDouble(a(15.1F,12.2F));
Console.WriteLine(re);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csharp_重载
{
class Program
{
static int a(int a1,int a2)
{
return a1-a2;
}
static float a(float b1,float b2)
{
return b1 + b2;
//return Convert.ToDouble(b1+b2);
}
static void Main(string[] args)
{
//double re= Convert.ToDouble(a(15.1,12));
double re= Convert.ToDouble(a(15.1,12.2));
Console.WriteLine(re);
}
}
}