1. I've started a massive SPAM purge, any accounts that have spammed are being removed, also for a short period new user signups are disallowed until the SPAM cleaning is finished.

what is static constructor

Discussion in 'General Programming' started by synchronous, Oct 1, 2012.

  1. synchronous

    synchronous Member

    Joined:
    Oct 17, 2011
    Messages:
    92
    Likes Received:
    2
    Trophy Points:
    18
    Gender:
    Male
    Location:
    Ranchi
    Loading...
  2. Tom

    Tom Member

    Joined:
    Sep 22, 2012
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    6
    Gender:
    Male
    Well I don't know exactly what programming language you're referring to but "static" usually means only the variables own method can set the value and it cannot be changed so it's "static."
  3. Jonathan Cottle

    Jonathan Cottle New Member

    Joined:
    Oct 5, 2012
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    A static constructor is used to initialize any static data, or to perform a particular action that needs performed once only. It is called automatically before the first instance is created or any static members are referenced.
    Thank you
  4. Riyaroy

    Riyaroy New Member

    Joined:
    Oct 18, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Female
    Location:
    Ahmedabad, Gujarat, India
    Static constructor initializes static data members when class is referenced first time. Static constructor not take a parameter and cannot be called directly. Static constructor is executed in the program automatically and a user has no control on it.
  5. tonnisymond

    tonnisymond New Member

    Joined:
    Nov 23, 2012
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    The static constructor is not called directly and it don't take parameters. this is executed in the program automatically and the user has not control on this.
  6. semaphore.v

    semaphore.v Member

    Joined:
    Feb 19, 2013
    Messages:
    105
    Likes Received:
    0
    Trophy Points:
    16
    Gender:
    Male
    Static constructor is used to initialize static data members.A static constructor does not take access modifiers or have parameters and can't access any non-static data member of a class.
  7. webalwaysnext

    webalwaysnext Member

    Joined:
    Feb 3, 2011
    Messages:
    160
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    http://www.paullimo.com
    Static constructor is used to initialize static data members as soon as the class is referenced first time, whereas an instance constructor is used to create an instance of that class with keyword. A static constructor does not take access modifiers or have parameters and can't access any non-static data member of a class.
  8. pryidevsblog

    pryidevsblog Member

    Joined:
    Dec 19, 2013
    Messages:
    147
    Likes Received:
    2
    Trophy Points:
    18
    Gender:
    Male
    You can't not call static constructor directly in to the functions. It is used to initialize the static member data. It is called automatically before the first instance is created or any static members are referenced.

    Hope this helps.
    Basant likes this.

Share This Page