C#基础

函数重载

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);
        }
    }
}

 

C#基础

上一篇:QT Demo 之 window(2) Splash


下一篇:C# Params的应用