Wednesday, July 22, 2015

Compile Time Polymorphism/Early Binding/Static Binding/Overloading

Same Method Name But, Difference Signature/Parameter:


namespace MethodOverloading
{
    public class Class1
    {
        public void Method(int x)
        {
            Console.WriteLine("Integer : " + x);
        }
        public void Method(char ch)
        {
            Console.WriteLine("character: " + ch);
        }
        public void Method(string str)
        {
            Console.WriteLine("String : " + str);
        }
        class Program
        {
            static void Main(string[] args)
            {
                Class1 obj1 = new Class1();
                obj1.Method(001);
                obj1.Method('S');
                obj1.Method("Soumik");

                Console.ReadKey();
            }
        }

    }

No comments:

Post a Comment