• 您的位置我爱Aspx >> VB.Net >> VB.Net中文教程(4) 类别继承(Inheritance)关系
  • VB.Net中文教程(4) 类别继承(Inheritance)关系

  • 作者:aspxer  来源:internet  日期:2007-5-20 14:00:35  关键字:.net
  • Public Class Person

    Private name As String

    Private age As Integer

    Public Sub SetValue(ByVal na As String, ByVal a As Integer)

    name = na

    age = a

    End Sub

    Public Function birthYear() As Integer

    birthYear = 2001 - age

    End Function

    Public Sub Display()

    Messagebox.Show("Name: " + name + " Age: " + str(age))

    End Sub

    End Class

    Public Class Teacher

    Inherits Person

    End Class

    @#-----------------------------------------------------------------------------------------

    Public Class Form1

    Inherits System.WinForms.Form

    Public Sub New()

    MyBase.New()

    Form1 = Me

    @#This call is required by the Win Form Designer.

    InitializeComponent()

    @#TODO: Add any initialization after the InitializeComponent() call

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:VB.Net中文教程(3) 继承与封装性
    下一篇:VB.Net中文教程(5)程序多重定义