当前位置:K88软件开发文章中心编程语言.NET.NET02 → 文章内容

VB.Net - 类与对象

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:59:05

e cost As Double Public Sub New(ByVal l As Double, ByVal w As Double) MyBase.New(l, w) End Sub Public Function GetCost() As Double Dim cost As Double cost = GetArea() * 70 Return cost End Function Public Overrides Sub Display() MyBase.Display() Console.WriteLine("Cost: {0}", GetCost()) End Sub 'end class TabletopEnd ClassClass RectangleTester Shared Sub Main() Dim t As Tabletop = New Tabletop(4.5, 7.5) t.Display() Console.ReadKey() End SubEnd Class当上述代码被编译和执行时,它产生了以下结果: Length: 4.5Width: 7.5Area: 33.75Cost: 2362.5 VB.Net支持多重继承。

上一页  [1] [2] [3] 


VB.Net - 类与对象