Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what are constructors and destructors

Answer Posted / dsr

A constructor is a method, which is called when an object
of a class type is constructed, and it usually used for
initialization. A constructor method has following
characteristics:

It has the same name as class

It has no return type

It does not return any value

Constructors are always public and we use them to
initialize variable.

There is default class constructor without parameter,
provided by C# internally if we did not write any
constructor. when ever compile that class,compiler create
the default constructor(with out parameters).

In the other hand a Destructor is also called a finalizer.
It is just opposite the constructor, it is a method called
when the garbage collector reclaims an object.

Constructors have following characteristics:

The name of a destructor is same as name of class

The destructor declared with a tilde (~).

Destructors are always public and never other than public.

Destructors take no arguments. So, there is only one
destructor per class.

Destructors have no return type.

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are login controls?

1868


What is the .net class that allows the retrieval of a data element using a unique key?

999


I want to create a project like google maps how can we do that with atlas?

927


What is IL code, CLR, CTS, GAC & GC?

1017


Explain the purpose of cache? How is it used? : Dot net architecture

982


Can I create my own permission set?

1018


What are the types of memory management? : Dot net architecture

878


Are there any third party logging components available?

929


Explain the Lapsed Listener problem in .net

1157


data types used in validation control

2194


What is private constructor? And it's use?

1106


How resource files are used in .net?

1021


What are the options provived by vss to the user? how it will help us while delevoping application?

2206


I can't be bothered with cas. Can I turn it off?

914


Explain domestic architecture artifacts? : .NET Architecture

928