Visual Basic 6.0 精简版,如何在实体类中定义类属性?
我想在类中定义类属性玩家类代码
'玩家类
'名称
Private Name As String
'性别
Private Sex As SexEnum
'级别
Private Level As Integer
'当前级别分数
Private LevelScore As Integer
'总分
Private SumScore As Integer
'境界
Private PlayerRealm As Realm
'豆豆虫
Private PlayerPeasBug As PeasBug
'属性Get和Set方法
Public Property Get GetName() As String
GetName = Name
End Property
Public Property Let SetName(SetName As String)
Name = SetName
End Property
Public Property Get GetSex() As SexEnum
GetSex = Sex
End Property
Public Property Let SetSex(SetSex As SexEnum)
Sex = SetSex
End Property
Public Property Get GetPlayerRealm() As Realm
GetPlayerRealm = PlayerRealm
End Property
Public Property Let SetPlayerRealm(ByVal SetPlayerRealm As Realm)
PlayerRealm = SetPlayerRealm
End Property
境界类代码
'境界类名称为Realm
'境界名称
Private Name As String
'进入下一境界所需分数
Private NextRealmScore As Integer
'属性Get和Set方法
Public Property Get GetName() As String
GetName = Name
End Property
Public Property Let SetName(SetName As String)
Name = SetName
End Property
Public Property Get GetNextRealmScore() As Integer
GetNextRealmScore = NextRealmScore
End Property
Public Property Let SetNextRealmScore(SetNextRealmScore As Integer)
NextRealmScore = SetNextRealmScore
End Property
我这样写报错
Set Realm = New Realm
Realm.SetName() = "先天"
Player.SetPlayerRealm() = Realm
我想问的是
'境界
Private PlayerRealm As Realm
Public Property Get GetPlayerRealm() As Realm
GetPlayerRealm = PlayerRealm
End Property
Public Property Let SetPlayerRealm(ByVal SetPlayerRealm As Realm)
PlayerRealm = SetPlayerRealm
End Property
这个该怎么写?
Private PlayerRealm As 什么类型
或者怎么实现在类中定义类属性?
谢谢