Public Class Customer
Public Sub New()
Debug.WriteLine("setuped")
End Sub
'--------New(Byval)---------
Public Sub New(ByVal sname As String)
Name = sname
Debug.WriteLine(Name & "setuped")
End Sub
Private m_Name As String
Property Name() As String
Get
Return m_Name
End Get
Set(ByVal Value As String)
m_Name = Value
End Set
End Property
Private m_address As String
Property Address() As String
Get
Return m_address
End Get
Set(ByVal Value As String)
m_address = Value
End Set
End Property
Public Function PlaceOrder() As String
End Function
Public Function CheckOrderStatus() As String
End Function
Public Overridable Function CalculateDiscount() As String
Return "base class"
End Function
End Class
-----------------------------------------------------------------------------
Public Class SubPro : Inherits Customer
Private m_zfjg As String
Property Zfjg() As String
Get
Return Zfjg
End Get
Set(ByVal Value As String)
m_zfjg = Value
End Set
End Property
Private m_bsc As String
Property Bsc() As String
Get
Return m_bsc
End Get
Set(ByVal Value As String)
m_bsc = Value
End Set
End Property
Public Overrides Function CalculateDiscount() As String
Return "sub class"
End Function
Public Function SubProSelf() As String
End Function
Public Sub New()
MyBase.New()
End Sub
End Class
本文介绍了一个使用 VB.NET 编写的客户类示例,包括构造函数、属性及继承扩展。主要展示了如何创建一个基本的客户类,并通过子类增加额外功能。

被折叠的 条评论
为什么被折叠?



