注册 登录
编程论坛 VB.NET论坛

Private 的访问限制?

yuner8282 发布于 2019-02-03 01:16, 2012 次点击
Public Class Customer
    Private strName As String
    Private intAge As Integer

    Public Sub New(name As String, age As Integer)
        strName = name
        intAge = age
    End Sub

    Public Sub Add(User As Customer)
        User.strName = "No.1"
        User.intAge = 30
        User.Show()
    End Sub

    Private Sub Show()
        MessageBox.Show(strName & " " & intAge.ToString)
    End Sub

End Class
0 回复
1