vb.net类的属性,函数与继承的学习

来源:互联网 发布:街道网络信息平台建设 编辑:程序博客网 时间:2024/05/21 06:30

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

原创粉丝点击