当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
计算机二级:VB类的继承
发布时间:2010/9/13 11:14:16 来源:www.xue.net 编辑:城市总裁吧

  Public Class CBaseHenry

  Private x As Integer = 10

  Protected y As Integer

  Sub New()

  Console.WriteLine("基类的构造")

  End Sub

  Protected Overrides Sub Finalize()

  Console.WriteLine("基类的析构")

  MyBase.Finalize()

  End Sub

  Public Overridable Function GetY(ByVal x As Integer) As Integer

  Me.y = me.x + x ‘private类型的me.x只能在基类中使用

  Console.WriteLine("基类的GetY方法,结果为:" & Me.y)

  Return Me.y

  End Function

  Public Sub OldY()

  Console.WriteLine("基类的OldY方法")

  End Sub

  End Class

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved