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
What is .net transaction?
How does an appdomain get created?
Can I create my own permission set?
What are library functions?
How cache coherency is eliminated? : Dot net architecture
What are .net mobile controls features? : Microsoft dot net mobile
Does application frame need host?
What is biginteger and when would you use that?
Name some changes done since version 3.0?
IS IT Possible to inherit the AJAX page from child class which(child) is inherit from page class.Because i should apply some security in child class
Explain COM with example?
Explain about clr?
What does the term "green architecture" mean? : .NET Architecture
Can you explain control extenders?
What is .net mobile lists. : Microsoft dot net mobile