Child.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LeiheDuixiang
{
/// <summary>
/// 小朋友
/// </summary>
class Child
{
/// <summary>
/// 求和
/// </summary>
/// <param name="n1"></param>
/// <param name="n2"></param>
public int Add(int n1, int n2)
{
int sum = n1 + n2;
return sum; //返回值
}
}
}
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LeiheDuixiang
{
class Program
{
static void Main(string[] args)
{
Child child = new Child();
int sum1;
sum1 = child.Add(3, 7);
Console.WriteLine("两个数字的和是" + sum1);
}
}
}