Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

polymorphism in C#

using System;

namespace polymor
{
    class Program
    {
        void Sum(int a, int b)
        {
            Console.WriteLine(a + b);
        }
       
        void Sum(int a, int b, int c)
        {
            Console.WriteLine(a + b + c);
        }
        void Sum(int a, int b, int c, int d)
        {
            Console.WriteLine(a + b + c + d);
        }
        static void Main(string[] args)
        {
           
           
            Program obj = new Program();
            obj.Sum(2,3);
            obj.Sum(2,3,4);
            obj.Sum(2, 3, 4,5);
            Console.ReadLine();
        }
    }
}
 
PREVIOUS NEXT
Tagged: #polymorphism
ADD COMMENT
Topic
Name
2+3 =