Saturday, April 26, 2025

C# - Method Overloading

using System;

namespace LearnCS
{
    class Program
    {


        static int MultiGrab(int x, int y) {
            return (x + y);
        }

        static string MultiGrab(string x, string y) {
            return (x + " " + y);
        }

        static string MultiGrab(char x, char y) {
            return (x + "" + y);
        }

        static void Main(string[] args)
        {

            Console.WriteLine(MultiGrab(5, 10));
            Console.WriteLine(MultiGrab("Some", "String"));
            Console.WriteLine(MultiGrab('A', 'Z'));

        }
    }
}

 

No comments:

Post a Comment

Tkinter Introduction - Top Widget, Method, Button

First, let's make shure that our tkinter module is working ok with simple  for loop that will spawn 5 instances of blank Tk window .  ...