'代码来源:代码街codejie点虐
创新互联公司自2013年创立以来,是专业互联网技术服务公司,拥有项目做网站、网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元陆川做网站,已为上家服务,为陆川各地企业和个人服务,联系电话:18980820575
'由于在vb点虐 里变量名不区分大小写(StuName和stuname是一样的),所以个别变量名需要修改
'在vb点虐 中,模块级变量的命名原则是以m_开头
Public Class Student
Private m_stuNo As String '学生号字段
Private m_stuName As String '学生姓名字段
Private m_stuAge As Integer '学生年龄字段
Private m_stuAddress As String '学生住址字段
'无参构造方法
Public Sub New()
End Sub
'有参构造方法
Public Sub New(ByVal stuNo As String, ByVal stuName As String, ByVal stuAge As Integer, ByVal stuAddress As String)
m_stuNo = stuNo
m_stuName = stuName
m_stuAge = stuAge
m_stuAddress = stuAddress
End Sub
'学生号属性
Public Property StuNo() As String
Get
Return m_stuNo
End Get
Set(ByVal value As String)
m_stuNo = value
End Set
End Property
'学生姓名属性
Public Property StuName() As String
Get
Return m_stuName
End Get
Set(ByVal value As String)
m_stuName = value
End Set
End Property
'学生年龄属性
Public Property StuAge() As Integer
Get
Return m_stuAge
End Get
Set(ByVal value As Integer)
m_stuAge = value
End Set
End Property
'学生住址属性
Public Property StuAddress() As String
Get
Return m_stuAddress
End Get
Set(ByVal value As String)
m_stuAddress = value
End Set
End Property
End Class
b错了因为vb变量名不能有空格答案应该是d
必须以字母开头不能有特殊的名称d选项没问题
这些命名都是对的,只是同时声明这6个变量时先要把分号改成逗号,另外1与2,3与4,5与6在VB.NET中认为同一变量,不能重复声明,所以只能声明3个。