C#基础

函数重载

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace exam
{
    class Program
    {
        /// <summary>
        /// 函数重载
        /// 函数名相同,参数类型或者参数个数不同
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Sayhello("Tom");
            Sayhello(20);
            Console.ReadKey();
        }
        static void Sayhello(string name)
        {
            Console.WriteLine("hello,{0}",name);
        }
        static void Sayhello(int age)
        {
            Console.WriteLine("u age is{0}", age);
        }
    }
}

 

posted @   crystal_C++  阅读(151)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示