Answers for "polymorphism c# programiz"

C#
0

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();
        }
    }
}
Posted by: Guest on February-01-2022

C# Answers by Framework

Browse Popular Code Answers by Language