Esempio n. 1
0
        static void Main(string[] args)
        {
            int     x = 0, y = 0;
            string  p = "", q = "";
            Prac9_1 obj0 = new Prac9_1();
            Prac9_1 obj1 = new Prac9_1("2. This is Parameterized constructor called");
            Prac9_1 obj2 = new Prac9_1("\t----------------");
            Prac9_1 obj3 = new Prac9_1("3. This is Copy constructor called", obj1, obj2);

            obj0.func("This is function overloading", x, y);
            obj0.func(p, q);
            Console.ReadKey();
        }
Esempio n. 2
0
 Prac9_1(string s, Prac9_1 obj1, Prac9_1 obj2)              //Copy constructor      3args,1object
 {
     Console.WriteLine("\n" + s);
     if (obj1.a > obj2.a)
     {
         Console.WriteLine("\tobj1 has greater a: " + obj1.a + "\n");
     }
     else if (obj2.a > obj1.a)
     {
         Console.WriteLine("\tobj2 has greater a: " + obj2.a + "\n");
     }
     else
     {
         Console.WriteLine("\tboth are equal\n");
     }
 }