Exemple #1
0
        public void Main()
        {
            Console.WriteLine("Function Overloading \n");
            Console.WriteLine("Function overloading allows multiple implementations of the same function in a class. " +
                              "Overloaded methods share the same name but have a unique signature. The number of parameters, types of parameters or both must be different. " +
                              "A function can't be overloaded on the basis of a different return type alone. ");

            FunctionOverloading obj = new FunctionOverloading();

            obj.setName("barack");
            Console.WriteLine(obj.name);
            obj.setName("barack ", " obama ");
            Console.WriteLine(obj.name);
            Console.WriteLine(obj.setName("barack ", "hussian", "obama"));
            Console.WriteLine("------------------------------------------------------------------------");
        }