March 8, 2016

code shortcut



 ClassA x = new ClassA();
ClassA x  ie x is variable of Class A

New ClassA()
This constructor does nothing except set the memory to its default values. The default constructor is public.

http://anil-businessanalyst.weebly.com/domain-knowledge.html

call method

DataTable dtCustomer= new ClsCustomerDAL().LoadCustomers();


using System;
public class Animal
{
    public Animal()
    {
        Console.WriteLine("Animal called");
    }
    public virtual void method()
    {
        Console.WriteLine("common method called from animal");
    }
}
public class Bird : Animal
{
    public Bird()
    {
        Console.WriteLine("Bird called");
    }
    public new void method()
    {
        Console.WriteLine("special method called from bird");
    }
    public void method1()
    {
        Console.WriteLine("BM1");
    }
}

class Program
{
    static void Main(string[] args)
    {
        //Animal obj = new Bird();// what is use of it?
        new Bird().method();
        //obj.method();
        Console.Read();
    }
}


public class Overload
    {
        public void Display()
        {
            int[] numbers = {10, 20, 30};
            DisplayOverload(40, numbers);
            Console.WriteLine(numbers[1]);
        }

        private void DisplayOverload(int a, params int[] parameterArray)
        {
            parameterArray[1] = 1000;
        }

    }
class Program
    {
        static void Main(string[] args)
        {
            Overload overload = new Overload();
            overload.Display();
            Console.ReadKey();
        }
    }
Output
1000

No comments: