<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FClass%2FOverride</id>
		<title>VB.Net/Class/Override - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FClass%2FOverride"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Class/Override&amp;action=history"/>
		<updated>2026-04-05T15:54:03Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Class/Override&amp;diff=348&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Class/Override&amp;diff=348&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/Class/Override&amp;diff=349&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/Class/Override&amp;diff=349&amp;oldid=prev"/>
				<updated>2010-05-26T12:42:40Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Overrides method from super(parent) class==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    &lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
         Dim win As New Window(1, 2)&lt;br /&gt;
         Dim lb As New ListBox(3, 4, &amp;quot;Stand alone list box&amp;quot;)&lt;br /&gt;
         Dim b As New Button(5, 6)&lt;br /&gt;
         win.DrawWindow(  )&lt;br /&gt;
         lb.DrawWindow(  )&lt;br /&gt;
         b.DrawWindow(  )&lt;br /&gt;
         Dim winArray(3) As Window&lt;br /&gt;
         winArray(0) = New Window(1, 2)&lt;br /&gt;
         winArray(1) = New ListBox(3, 4, &amp;quot;List box in array&amp;quot;)&lt;br /&gt;
         winArray(2) = New Button(5, 6)&lt;br /&gt;
         Dim i As Integer&lt;br /&gt;
         For i = 0 To 2&lt;br /&gt;
             winArray(i).DrawWindow(  )&lt;br /&gt;
         Next i&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
 Public Class Window&lt;br /&gt;
     Public Sub New(ByVal top As Integer, ByVal left As Integer)&lt;br /&gt;
         Me.top = top&lt;br /&gt;
         Me.left = left&lt;br /&gt;
     End Sub&lt;br /&gt;
     Public Overridable Sub DrawWindow(  )&lt;br /&gt;
         Console.WriteLine(&amp;quot;Window: drawing Window at {0}, {1}&amp;quot;, top, left)&lt;br /&gt;
     End Sub&lt;br /&gt;
     Protected top As Integer&lt;br /&gt;
     Protected left As Integer&lt;br /&gt;
 End Class&lt;br /&gt;
 Public Class ListBox&lt;br /&gt;
     Inherits Window&lt;br /&gt;
     Public Sub New(ByVal top As Integer, ByVal left As Integer, ByVal contents As String)&lt;br /&gt;
         MyBase.New(top, left)&lt;br /&gt;
         listBoxContents = contents&lt;br /&gt;
     End Sub&lt;br /&gt;
     Public Overrides Sub DrawWindow(  )&lt;br /&gt;
         MyBase.DrawWindow(  )&lt;br /&gt;
         Console.WriteLine(&amp;quot;Writing string to the listbox: {0}&amp;quot;, listBoxContents)&lt;br /&gt;
     End Sub&lt;br /&gt;
     Private listBoxContents As String &amp;quot; new member variable&lt;br /&gt;
 End Class &amp;quot;ListBox&lt;br /&gt;
 Public Class Button&lt;br /&gt;
     Inherits Window&lt;br /&gt;
     Public Sub New(ByVal top As Integer, ByVal left As Integer)&lt;br /&gt;
         MyBase.New(top, left)&lt;br /&gt;
     End Sub&lt;br /&gt;
     Public Overrides Sub DrawWindow(  )&lt;br /&gt;
         Console.WriteLine( _&lt;br /&gt;
           &amp;quot;Drawing a button at {0}, {1}&amp;quot; + ControlChars.Lf, top, Left)&lt;br /&gt;
     End Sub &amp;quot;DrawWindow&lt;br /&gt;
 End Class &amp;quot;Button&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Override the Finalize Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main(ByVal args As String())&lt;br /&gt;
      Dim circle1, circle2 As Circle&lt;br /&gt;
      circle1 = New Circle(72, 29, 4.5) &amp;quot; instantiate objects&lt;br /&gt;
      circle2 = New Circle(5, 5, 10)&lt;br /&gt;
      circle1 = Nothing &amp;quot; mark objects for garbage collection&lt;br /&gt;
      circle2 = Nothing&lt;br /&gt;
      System.GC.Collect() &amp;quot; request garbage collector to execute&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
Public Class Circle&lt;br /&gt;
   Inherits Point &amp;quot; Circle Inherits from class Point&lt;br /&gt;
   Private mRadius As Double&lt;br /&gt;
   &amp;quot; default constructor&lt;br /&gt;
   Public Sub New()&lt;br /&gt;
      &amp;quot; implicit call to Point constructor occurs here&lt;br /&gt;
      Radius = 0&lt;br /&gt;
      Console.WriteLine(&amp;quot;Circle constructor: {0}&amp;quot;, Me)&lt;br /&gt;
   End Sub &amp;quot; New&lt;br /&gt;
   &amp;quot; constructor&lt;br /&gt;
   Public Sub New(ByVal xValue As Integer, _&lt;br /&gt;
      ByVal yValue As Integer, ByVal radiusValue As Double)&lt;br /&gt;
      &amp;quot; use MyBase reference to Point constructor explicitly&lt;br /&gt;
      MyBase.New(xValue, yValue)&lt;br /&gt;
      Radius = radiusValue&lt;br /&gt;
      Console.WriteLine(&amp;quot;Circle constructor: {0}&amp;quot;, Me)&lt;br /&gt;
   End Sub &amp;quot; New&lt;br /&gt;
   &amp;quot; finalizer overrides version in class Point&lt;br /&gt;
   Protected Overrides Sub Finalize()&lt;br /&gt;
      Console.WriteLine(&amp;quot;Circle Finalizer: {0}&amp;quot;, Me)&lt;br /&gt;
      MyBase.Finalize() &amp;quot; call Point finalizer&lt;br /&gt;
   End Sub &amp;quot; Finalize&lt;br /&gt;
   &amp;quot; property Radius&lt;br /&gt;
   Public Property Radius() As Double&lt;br /&gt;
      Get&lt;br /&gt;
         Return mRadius&lt;br /&gt;
      End Get&lt;br /&gt;
      Set(ByVal radiusValue As Double)&lt;br /&gt;
         If radiusValue &amp;gt; 0 Then&lt;br /&gt;
            mRadius = radiusValue&lt;br /&gt;
         End If&lt;br /&gt;
      End Set&lt;br /&gt;
   End Property &amp;quot; Radius&lt;br /&gt;
   &amp;quot; calculate Circle diameter&lt;br /&gt;
   Public Function Diameter() As Double&lt;br /&gt;
      Return mRadius * 2&lt;br /&gt;
   End Function &amp;quot; Diameter&lt;br /&gt;
   &amp;quot; calculate Circle circumference&lt;br /&gt;
   Public Function Circumference() As Double&lt;br /&gt;
      Return Math.PI * Diameter()&lt;br /&gt;
   End Function &amp;quot; Circumference&lt;br /&gt;
   &amp;quot; calculate Circle area&lt;br /&gt;
   Public Overridable Function Area() As Double&lt;br /&gt;
      Return Math.PI * mRadius ^ 2&lt;br /&gt;
   End Function &amp;quot; Area&lt;br /&gt;
   &amp;quot; return String representation of Circle&lt;br /&gt;
   Public Overrides Function ToString() As String&lt;br /&gt;
      &amp;quot; use MyBase reference to return Point String&lt;br /&gt;
      Return &amp;quot;Center = &amp;quot; &amp;amp; MyBase.ToString() &amp;amp; _&lt;br /&gt;
         &amp;quot;; Radius = &amp;quot; &amp;amp; mRadius&lt;br /&gt;
   End Function &amp;quot; ToString&lt;br /&gt;
End Class&lt;br /&gt;
Public Class Point&lt;br /&gt;
   &amp;quot; point coordinate&lt;br /&gt;
   Private mX, mY As Integer&lt;br /&gt;
   &amp;quot; default constructor&lt;br /&gt;
   Public Sub New()&lt;br /&gt;
      &amp;quot; implicit call to Object constructor occurs here&lt;br /&gt;
      X = 0&lt;br /&gt;
      Y = 0&lt;br /&gt;
      Console.WriteLine(&amp;quot;Point constructor: {0}&amp;quot;, Me)&lt;br /&gt;
   End Sub &amp;quot; New&lt;br /&gt;
   &amp;quot; constructor&lt;br /&gt;
   Public Sub New(ByVal xValue As Integer, _&lt;br /&gt;
      ByVal yValue As Integer)&lt;br /&gt;
      &amp;quot; implicit call to Object constructor occurs here&lt;br /&gt;
      X = xValue&lt;br /&gt;
      Y = yValue&lt;br /&gt;
      Console.WriteLine(&amp;quot;Point constructor: {0}&amp;quot;, Me)&lt;br /&gt;
   End Sub &amp;quot; New&lt;br /&gt;
   &amp;quot; finalizer overrides version in class Object&lt;br /&gt;
   Protected Overrides Sub Finalize()&lt;br /&gt;
      Console.WriteLine(&amp;quot;Point Finalizer: {0}&amp;quot;, Me)&lt;br /&gt;
      MyBase.Finalize() &amp;quot; call Object finalizer&lt;br /&gt;
   End Sub &amp;quot; Finalize&lt;br /&gt;
   &amp;quot; property X&lt;br /&gt;
   Public Property X() As Integer&lt;br /&gt;
      Get&lt;br /&gt;
         Return mX&lt;br /&gt;
      End Get&lt;br /&gt;
      Set(ByVal xValue As Integer)&lt;br /&gt;
         mX = xValue &amp;quot; no need for validation&lt;br /&gt;
      End Set&lt;br /&gt;
   End Property &amp;quot; X&lt;br /&gt;
   &amp;quot; property Y &lt;br /&gt;
   Public Property Y() As Integer&lt;br /&gt;
      Get&lt;br /&gt;
         Return mY&lt;br /&gt;
      End Get&lt;br /&gt;
      Set(ByVal yValue As Integer)&lt;br /&gt;
         mY = yValue &amp;quot; no need for validation&lt;br /&gt;
      End Set&lt;br /&gt;
   End Property &amp;quot; Y&lt;br /&gt;
   &amp;quot; return String representation of Point&lt;br /&gt;
   Public Overrides Function ToString() As String&lt;br /&gt;
      Return &amp;quot;[&amp;quot; &amp;amp; mX &amp;amp; &amp;quot;, &amp;quot; &amp;amp; mY &amp;amp; &amp;quot;]&amp;quot;&lt;br /&gt;
   End Function &amp;quot; ToString&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>