C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
Today
    Last 7 Days more...






    Resources » Definitions » General »

    Constructors


    Posted Date: 10 Oct 2008    Resource Type: Definitions    Category: General
    Author: Miss Meetu ChoudharyMember Level: Diamond    
    Rating: 1 out of 5Points: 5



    A procedure or function or method that is used for creating and initializing objects. In any language, constructor is called after the object has been created and is used mainly to initialize the object's internal state i.e. there member variables. It is a special method that initializes an object when the object is created. In the class, a constructor has the same name as the class.


    we have following types of constructors

    1. copy constructor
    2. default constructor
    3. naval constructor
    4. universal constructor
    5. virtual constructor
    6. constructor function
    7. constructor brabham
    8. taller del constructor

    --
    Thanks and Regards
    Meetu Choudhary




    Responses

    Author: lingesh    14 Oct 2008Member Level: Silver   Points : 2
    Ya the copy constructor is the most interesting one because we pass the object during the object creation.

    class a
    {
    public int x;
    public a()
    {
    x=10;
    }
    public a(class z) \\ copy constructor
    {
    x=100;
    }
    }
    class b
    {
    public static void Main()
    {
    a obj1 = new a();
    System.Console.WriteLine(x) ;
    b obj2 = new a(obj1);
    System.Console.WriteLine(x) ;

    }
    }
    output
    10
    100;



    Author: lingesh    14 Oct 2008Member Level: Silver   Points : 2
    Ya the copy constructor is the most interesting one because we pass the object during the object creation.

    class a
    {
    public int x;
    public a()
    {
    x=10;
    }
    public a(class z) \\ copy constructor
    {
    x=100;
    }
    }
    class b
    {
    public static void Main()
    {
    a obj1 = new a();
    System.Console.WriteLine(x) ;
    b obj2 = new a(obj1);
    System.Console.WriteLine(x) ;

    }
    }
    output
    10
    100;



    Author: Miss Meetu Choudhary    14 Oct 2008Member Level: Diamond   Points : 1
    Yes Very True
    Nice Example Given by you thanks

    ==
    Thanks and Regards
    Meetu Choudhary
    -
    http://www.dotnetspider.com/sites/20/-Learn-ASP-Net.aspx
    http://www.dotnetspider.com/sites/21/-DotNet-Expertise.aspx


    Author: lingesh    20 Oct 2008Member Level: Silver   Points : 1
    Anybody know about the static constructors?
    does it only declared in static classes or normal classes?


    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Sign In to add tags.
    Constructors  .  Constructor  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: AJAX
    Previous Resource: What is strong name?
    Return to Discussion Resource Index
    Post New Resource
    Category: General


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers

    About Us    Contact Us    Privacy Policy    Terms Of Use