<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: Introduction to Constructors and Destructors in VB.NET</title>
	<atom:link href="http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/</link>
	<description>Articles on VB.NET and Software Development Team Leadership</description>
	<pubDate>Mon, 21 May 2012 18:56:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kevin</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1430</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Fri, 20 Nov 2009 20:24:44 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1430</guid>
		<description>I come froma  C/C++ background.  Constructors and deconstructers are common in OO languages.  

Deconstructors are generally used to clean up memory - like releasing a variable from memory - or closing a database connection.  In some langauges like objc on the iPhone the deconstructor is used a lot since you have to do your own memory management.

A common way of using constructors is to have them nested providing default values for for other constructors.  However, for most people in VB you will use optional parameters instead of the following example.  Optional parameters aren't usually available in other languages so this is how it is handled.

Public Sub New()
   Me.New("Category 1")
End Sub

Public Sub New(category as String)
   Me.New(category, 1))
End Sub

Public Sub New(category as String, level as Integer)
   m_Category = strCat
   m_Level = level
End Sub

There might be certain cases with VB to do the above.  But most likely you will do a Public Sub New(Optional category as String = "Category 1", Optional level as Integer = 1)

Note: The author mentioned this but I will explain it in a little more detail.  You cannot have the following two constructors
Public Sub New(category as String, level as Integer)
Public Sub New(name as String, ID as Integer)

You cannot have constructors with the same signature, in this case two parameters where the first is a string and the second is an integer.  The compiler won't know which one to use if you do a Dim myVar as New MyClass("Me", 1).</description>
		<content:encoded><![CDATA[<p>I come froma  C/C++ background.  Constructors and deconstructers are common in OO languages.  </p>
<p>Deconstructors are generally used to clean up memory - like releasing a variable from memory - or closing a database connection.  In some langauges like objc on the iPhone the deconstructor is used a lot since you have to do your own memory management.</p>
<p>A common way of using constructors is to have them nested providing default values for for other constructors.  However, for most people in VB you will use optional parameters instead of the following example.  Optional parameters aren&#8217;t usually available in other languages so this is how it is handled.</p>
<p>Public Sub New()<br />
   Me.New(&#8221;Category 1&#8243;)<br />
End Sub</p>
<p>Public Sub New(category as String)<br />
   Me.New(category, 1))<br />
End Sub</p>
<p>Public Sub New(category as String, level as Integer)<br />
   m_Category = strCat<br />
   m_Level = level<br />
End Sub</p>
<p>There might be certain cases with VB to do the above.  But most likely you will do a Public Sub New(Optional category as String = &#8220;Category 1&#8243;, Optional level as Integer = 1)</p>
<p>Note: The author mentioned this but I will explain it in a little more detail.  You cannot have the following two constructors<br />
Public Sub New(category as String, level as Integer)<br />
Public Sub New(name as String, ID as Integer)</p>
<p>You cannot have constructors with the same signature, in this case two parameters where the first is a string and the second is an integer.  The compiler won&#8217;t know which one to use if you do a Dim myVar as New MyClass(&#8221;Me&#8221;, 1).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gokul</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1388</link>
		<dc:creator>Gokul</dc:creator>
		<pubDate>Mon, 24 Aug 2009 11:38:48 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1388</guid>
		<description>Send Sample code using constructor in vb.net</description>
		<content:encoded><![CDATA[<p>Send Sample code using constructor in vb.net</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yona</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1374</link>
		<dc:creator>yona</dc:creator>
		<pubDate>Thu, 09 Jul 2009 12:35:42 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1374</guid>
		<description>Please add a simple example for destructor method</description>
		<content:encoded><![CDATA[<p>Please add a simple example for destructor method</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Robbins</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1373</link>
		<dc:creator>Mike Robbins</dc:creator>
		<pubDate>Mon, 06 Jul 2009 15:16:57 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1373</guid>
		<description>Great information very useful</description>
		<content:encoded><![CDATA[<p>Great information very useful</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: suresh</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1224</link>
		<dc:creator>suresh</dc:creator>
		<pubDate>Wed, 15 Oct 2008 07:18:13 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1224</guid>
		<description>can u send simple simple example code for constructor in vb .net</description>
		<content:encoded><![CDATA[<p>can u send simple simple example code for constructor in vb .net</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: midhat</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1221</link>
		<dc:creator>midhat</dc:creator>
		<pubDate>Wed, 08 Oct 2008 05:06:46 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1221</guid>
		<description>Thanks so much.This is very helpful article. It helps me out alot.</description>
		<content:encoded><![CDATA[<p>Thanks so much.This is very helpful article. It helps me out alot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Haroon</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1212</link>
		<dc:creator>Haroon</dc:creator>
		<pubDate>Wed, 17 Sep 2008 15:21:06 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1212</guid>
		<description>Please post a small sample code to elaborate it. especially for destructor</description>
		<content:encoded><![CDATA[<p>Please post a small sample code to elaborate it. especially for destructor</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Haroon</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-1211</link>
		<dc:creator>Haroon</dc:creator>
		<pubDate>Wed, 17 Sep 2008 15:18:30 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-1211</guid>
		<description>Please post a simple example code for this</description>
		<content:encoded><![CDATA[<p>Please post a simple example code for this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jfrankcarr</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-807</link>
		<dc:creator>jfrankcarr</dc:creator>
		<pubDate>Wed, 24 Oct 2007 20:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-807</guid>
		<description>Thanks for stopping by Reyad. I'm glad my article helped you out.</description>
		<content:encoded><![CDATA[<p>Thanks for stopping by Reyad. I&#8217;m glad my article helped you out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reyad</title>
		<link>http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/comment-page-1/#comment-806</link>
		<dc:creator>reyad</dc:creator>
		<pubDate>Wed, 24 Oct 2007 20:26:06 +0000</pubDate>
		<guid isPermaLink="false">http://vbnotebookfor.net/2007/09/12/introduction-to-constructors-and-destructors-in-vbnet/#comment-806</guid>
		<description>thank you so much ,, i been looking since hours at some website that explains to me the "constructor"
thank alot .</description>
		<content:encoded><![CDATA[<p>thank you so much ,, i been looking since hours at some website that explains to me the &#8220;constructor&#8221;<br />
thank alot .</p>
]]></content:encoded>
	</item>
</channel>
</rss>

