What are constructors in .Net

Questions by Bhanu

Showing Answers 1 - 9 of 9 Answers

m5m

  • Jul 14th, 2013
 

Constractor is Any code works automatically once you create an object of this class Such As :
ex 1:
c#
public car()
{
// Any code works automatically once you create an object of this class
}
ex:2 VB.Net
Sub New()
(
messagebox.show("Welcome")
)

Razia

  • Jul 18th, 2013
 

Constructor is a method with same name as class and gets called once you instantiate/create a object of the class.
Constructors can be overloaded in the same way as other normal methods.

Ranjit jana

  • Aug 7th, 2013
 

Constructor is a special type of method use to initialize the object of its existing class.Its declare same name as its existing class without return type.

  Was this answer useful?  Yes

Raj

  • Nov 28th, 2013
 

Constructor is a special type of method which intialized in the class, which has same name of the class. it has no any return value.

Code
  1. public void class

  2. {

  3. public class // This is constructor, which no has return type.

  4. {

  5. }

  6. }

  Was this answer useful?  Yes

Jimuta Bahan Sahu

  • May 27th, 2014
 

Constructor is a special member function which name is same as class name and when we create the object of that class constructor automatically fire.

  Was this answer useful?  Yes

Huy

  • Jul 15th, 2014
 

constructors are simply methods inside a class. These methods however has the SAME name as the class and are executed automatically whenever the class is instantiated. Parametrized constructors takes in arguments, while a default or parameter less constructor takes in no argument

  Was this answer useful?  Yes

sunil

  • Sep 24th, 2014
 

Constructor is the special type of methods, which is called when we crate the object for the class.
Constructor will have same name as class name.
overloaded constructor can also be there.

  Was this answer useful?  Yes

Abinash Dinakaran

  • Dec 22nd, 2014
 

Constructors are the member functions which has same name as class name. Constructors are used to initialize a value for a variable so that we can be able to avoid junk values thrown to a variable.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions