method overloading

in Method overloading the appropriate method called depends on parameters.

using System;

namespace namespace1

{
    class class1
    {
        public static void print(int a)
        {

            Console.WriteLine(a.ToString());
        }
        public static void print(int a, int b)
        {
            Console.WriteLine(a.ToString()+ " "+b.ToString());
        }
        public static void Main()
        {
            print(30);
            print(20, 30);
            Console.ReadLine();        
        }
            
    }
    
}
Ebook Download
View all
Learn
View all