(转)在VB.NET中处理构造函数时值得注意的两个陈述

前端之家收集整理的这篇文章主要介绍了(转)在VB.NET中处理构造函数时值得注意的两个陈述前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  在VB.NET中处理构造函数时,有两个陈述值得注意:

  (1)如果类型不包含任何实例构造函数声明,则VB.NET提供默认的构造函数
  默认参数调用直接基类的无参数构造函数。如果基类没有可访问的无参数构造函数,则发生编译期错误

  (2)构造函数不能继承;

  陈述(1)包含两个方面的信息:①是如果类型不包含任何实例构造函数声明,则VB.NET提供默认的构造函数,即下面的声明是允许的,在类Shape中我们没有显式声明任何构造函数,但是我们仍然可以通过VB.NET自动提供的无参数构造函数New()来实例化类;

Highlighter1_0_83_Open_Text.style.display='none'; CodeHighlighter1_0_83_Closed_Image.style.display='inline'; CodeHighlighter1_0_83_Closed_Text.style.display='inline';" id="CodeHighlighter1_0_83_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_0_83_Closed_Text.style.display='none'; CodeHighlighter1_0_83_Open_Image.style.display='inline'; CodeHighlighter1_0_83_Open_Text.style.display='inline';" id="CodeHighlighter1_0_83_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

ModuleTest

Highlighter1_20_72_Open_Text.style.display='none'; CodeHighlighter1_20_72_Closed_Image.style.display='inline'; CodeHighlighter1_20_72_Closed_Text.style.display='inline';" id="CodeHighlighter1_20_72_Open_Image" style="display: inline" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_20_72_Closed_Text.style.display='none'; CodeHighlighter1_20_72_Open_Image.style.display='inline'; CodeHighlighter1_20_72_Open_Text.style.display='inline';" id="CodeHighlighter1_20_72_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubMain()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

Dimshape1AsShape=NewShape

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndModule

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">


Highlighter1_93_161_Open_Text.style.display='none'; CodeHighlighter1_93_161_Closed_Image.style.display='inline'; CodeHighlighter1_93_161_Closed_Text.style.display='inline';" id="CodeHighlighter1_93_161_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_93_161_Closed_Text.style.display='none'; CodeHighlighter1_93_161_Open_Image.style.display='inline'; CodeHighlighter1_93_161_Open_Text.style.display='inline';" id="CodeHighlighter1_93_161_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

Public ClassShape

Highlighter1_113_151_Open_Text.style.display='none'; CodeHighlighter1_113_151_Closed_Image.style.display='inline'; CodeHighlighter1_113_151_Closed_Text.style.display='inline';" id="CodeHighlighter1_113_151_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_113_151_Closed_Text.style.display='none'; CodeHighlighter1_113_151_Open_Image.style.display='inline'; CodeHighlighter1_113_151_Open_Text.style.display='inline';" id="CodeHighlighter1_113_151_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubDraw()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndClass

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">


  ②是如果类型中包含有实例构造函数的声明,那么VB.NET不再提供默认的构造函数,例如,我们在类Shape中添加了一个带参数的构造函数

Highlighter1_7_144_Open_Text.style.display='none'; CodeHighlighter1_7_144_Closed_Image.style.display='inline'; CodeHighlighter1_7_144_Closed_Text.style.display='inline';" id="CodeHighlighter1_7_144_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_7_144_Closed_Text.style.display='none'; CodeHighlighter1_7_144_Open_Image.style.display='inline'; CodeHighlighter1_7_144_Open_Text.style.display='inline';" id="CodeHighlighter1_7_144_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

Public ClassShape

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

Private_ptAsPoint

Highlighter1_49_86_Open_Text.style.display='none'; CodeHighlighter1_49_86_Closed_Image.style.display='inline'; CodeHighlighter1_49_86_Closed_Text.style.display='inline';" id="CodeHighlighter1_49_86_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_49_86_Closed_Text.style.display='none'; CodeHighlighter1_49_86_Open_Image.style.display='inline'; CodeHighlighter1_49_86_Open_Text.style.display='inline';" id="CodeHighlighter1_49_86_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew(pAsPoint)

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

_pt
=p

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_96_134_Open_Text.style.display='none'; CodeHighlighter1_96_134_Closed_Image.style.display='inline'; CodeHighlighter1_96_134_Closed_Text.style.display='inline';" id="CodeHighlighter1_96_134_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_96_134_Closed_Text.style.display='none'; CodeHighlighter1_96_134_Open_Image.style.display='inline'; CodeHighlighter1_96_134_Open_Text.style.display='inline';" id="CodeHighlighter1_96_134_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubDraw()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndClass

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">


  那么,如果直接实例化类时,则会产生错误

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">

Dim shape1 As Shape = New Shape

  只能通过调用Shape类中显式声明的带参数的构造函数来实例化类,如下,

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">

Dim shape1 As Shape = New Shape( New Point( 0 , 0 ))

  因此,如果要在类中同时使用无参数和带参数的构造函数,必须同时显式地声明两种构造函数

Highlighter1_7_191_Open_Text.style.display='none'; CodeHighlighter1_7_191_Closed_Image.style.display='inline'; CodeHighlighter1_7_191_Closed_Text.style.display='inline';" id="CodeHighlighter1_7_191_Open_Image" style="display: inline" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_7_191_Closed_Text.style.display='none'; CodeHighlighter1_7_191_Open_Image.style.display='inline'; CodeHighlighter1_7_191_Open_Text.style.display='inline';" id="CodeHighlighter1_7_191_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

Public ClassShape

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

Private_ptAsPoint

Highlighter1_49_86_Open_Text.style.display='none'; CodeHighlighter1_49_86_Closed_Image.style.display='inline'; CodeHighlighter1_49_86_Closed_Text.style.display='inline';" id="CodeHighlighter1_49_86_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_49_86_Closed_Text.style.display='none'; CodeHighlighter1_49_86_Open_Image.style.display='inline'; CodeHighlighter1_49_86_Open_Text.style.display='inline';" id="CodeHighlighter1_49_86_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_96_133_Open_Text.style.display='none'; CodeHighlighter1_96_133_Closed_Image.style.display='inline'; CodeHighlighter1_96_133_Closed_Text.style.display='inline';" id="CodeHighlighter1_96_133_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_96_133_Closed_Text.style.display='none'; CodeHighlighter1_96_133_Open_Image.style.display='inline'; CodeHighlighter1_96_133_Open_Text.style.display='inline';" id="CodeHighlighter1_96_133_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew(pAsPoint)

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

_pt
=p

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_143_181_Open_Text.style.display='none'; CodeHighlighter1_143_181_Closed_Image.style.display='inline'; CodeHighlighter1_143_181_Closed_Text.style.display='inline';" id="CodeHighlighter1_143_181_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_143_181_Closed_Text.style.display='none'; CodeHighlighter1_143_181_Open_Image.style.display='inline'; CodeHighlighter1_143_181_Open_Text.style.display='inline';" id="CodeHighlighter1_143_181_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubDraw()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndClass

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">



  陈述(2),构造函数不能继承,即,如果要使子类与基类有相同的构造函数,那么必须在每个子类中都显式的声明与基类构造相同的构造函数,例如:

Highlighter1_19_187_Open_Text.style.display='none'; CodeHighlighter1_19_187_Closed_Image.style.display='inline'; CodeHighlighter1_19_187_Closed_Text.style.display='inline';" id="CodeHighlighter1_19_187_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_19_187_Closed_Text.style.display='none'; CodeHighlighter1_19_187_Open_Image.style.display='inline'; CodeHighlighter1_19_187_Open_Text.style.display='inline';" id="CodeHighlighter1_19_187_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

Public MustInherit ClassShape

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

Private_ptAsPoint

Highlighter1_61_98_Open_Text.style.display='none'; CodeHighlighter1_61_98_Closed_Image.style.display='inline'; CodeHighlighter1_61_98_Closed_Text.style.display='inline';" id="CodeHighlighter1_61_98_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_61_98_Closed_Text.style.display='none'; CodeHighlighter1_61_98_Open_Image.style.display='inline'; CodeHighlighter1_61_98_Open_Text.style.display='inline';" id="CodeHighlighter1_61_98_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_108_145_Open_Text.style.display='none'; CodeHighlighter1_108_145_Closed_Image.style.display='inline'; CodeHighlighter1_108_145_Closed_Text.style.display='inline';" id="CodeHighlighter1_108_145_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_108_145_Closed_Text.style.display='none'; CodeHighlighter1_108_145_Open_Image.style.display='inline'; CodeHighlighter1_108_145_Open_Text.style.display='inline';" id="CodeHighlighter1_108_145_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew(pAsPoint)

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

_pt
=p

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_168_187_Open_Text.style.display='none'; CodeHighlighter1_168_187_Closed_Image.style.display='inline'; CodeHighlighter1_168_187_Closed_Text.style.display='inline';" id="CodeHighlighter1_168_187_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_168_187_Closed_Text.style.display='none'; CodeHighlighter1_168_187_Open_Image.style.display='inline'; CodeHighlighter1_168_187_Open_Text.style.display='inline';" id="CodeHighlighter1_168_187_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicMustOverrideSubDraw()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndClass

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">


Highlighter1_197_370_Open_Text.style.display='none'; CodeHighlighter1_197_370_Closed_Image.style.display='inline'; CodeHighlighter1_197_370_Closed_Text.style.display='inline';" id="CodeHighlighter1_197_370_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif">

Highlighter1_197_370_Closed_Text.style.display='none'; CodeHighlighter1_197_370_Open_Image.style.display='inline'; CodeHighlighter1_197_370_Open_Text.style.display='inline';" id="CodeHighlighter1_197_370_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif">

Public ClassLine

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

InheritsShape

Highlighter1_232_249_Open_Text.style.display='none'; CodeHighlighter1_232_249_Closed_Image.style.display='inline'; CodeHighlighter1_232_249_Closed_Text.style.display='inline';" id="CodeHighlighter1_232_249_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_232_249_Closed_Text.style.display='none'; CodeHighlighter1_232_249_Open_Image.style.display='inline'; CodeHighlighter1_232_249_Open_Text.style.display='inline';" id="CodeHighlighter1_232_249_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_259_302_Open_Text.style.display='none'; CodeHighlighter1_259_302_Closed_Image.style.display='inline'; CodeHighlighter1_259_302_Closed_Text.style.display='inline';" id="CodeHighlighter1_259_302_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_259_302_Closed_Text.style.display='none'; CodeHighlighter1_259_302_Open_Image.style.display='inline'; CodeHighlighter1_259_302_Open_Text.style.display='inline';" id="CodeHighlighter1_259_302_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicSubNew(pAsPoint)

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

MyBase.New(p)

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

Highlighter1_322_360_Open_Text.style.display='none'; CodeHighlighter1_322_360_Closed_Image.style.display='inline'; CodeHighlighter1_322_360_Closed_Text.style.display='inline';" id="CodeHighlighter1_322_360_Open_Image" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif">

Highlighter1_322_360_Closed_Text.style.display='none'; CodeHighlighter1_322_360_Open_Image.style.display='inline'; CodeHighlighter1_322_360_Open_Text.style.display='inline';" id="CodeHighlighter1_322_360_Closed_Image" style="display: none" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif">

PublicOverridesSubDraw()

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif">

'somecodeshere.

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">

EndSub

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">

EndClass

PHP?refimg=" + this.src)" height="16" src="http://img.jb51.cc/vcimg/static/loading.png" width="11" align="top" src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif">


  这一点非常重要而且也很有意义。因为我们往往倾向于认为子类继承了基类所有的属性方法,这往往导致我们的程序出现编译错误
  综合以上两个陈述,在实际编程中应遵循一个原则:在类中,无论是基类还是子类,显式地声明所有需要的无参数或带参数构造函数。遵循这个原则,既有利于提高编译正确代码的速度,也有利于自己和其他程序员理解代码
原文链接:https://www.f2er.com/vb/262439.html

猜你在找的VB相关文章