Q of Day: Constructors, Destructors and Garbage Collection

2 views
Skip to first unread message

dorit...@aol.com

unread,
Jul 13, 2008, 6:39:43 PM7/13/08
to davids-comput...@googlegroups.com
I tried to send this a couple of times last week but it came back
I'll try again

Explain what constructors and destructors are, and describe their use.

Briefly describe how garbage collection works.

 I
V


 I
V


 I
V


The constructor is the method that initializes a class or structure and
is run when a the is first instantiated.
It is used to set defaults values and perform other tasks required by the class.

A destructor is the method that is run as the object is being reclaimed by garbage collection.
It contains any code that is requred for cleanup of the object.



The garbage collector is a thread that runs in the background of managed .Net applications.
It constantly traces the reference tree
and attempts to find objects that are no longer referenced.
When a nonreferenced object is found, its memory is reclaimed for later use.

The Famous, the Infamous, the Lame - in your browser. Get the TMZ Toolbar Now!
Reply all
Reply to author
Forward
0 new messages