Computer Science, asked by ame34, 11 months ago

an example of polymorphism by creating a class in Bluej​

Answers

Answered by kingsleensingapore
1

Answer:

Polymorphism means one name many forms. Polymorphism means one object behaving as multiple forms. One basic function behaves in different forms. In other words, "Multiple forms of a single object is called Polymorphism."

Explanation:

namespace MethodOverloadingByMe

{

   class Program

   {

       public class TestOverloading

       {

           public void Add(string a1, string a2)

           {

               Console.WriteLine("Adding Two String :" + a1 + a2);

           }

           public void Add(int a1, int a2)

           {

               Console.WriteLine("Adding Two Integer :" +  a1 + a2);

           }

       }

       static void Main(string[] args)

       {

           TestOverloading obj = new TestOverloading();

           obj.Add("Test" , "New");

           obj.Add(5, 10);

           Console.ReadLine();

       }

   }

}

Similar questions