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

 

posted @ 2014-12-04 17:05  crystal_C++  阅读(148)  评论(0编辑  收藏  举报