大家好,我必须在 Classic ASP 中创建一个网站,我真的想做一个干净的设计,所以我会尝试将所有内容放在类和模型中以模拟 ViewModel 模式。
所以你能告诉我这种创建对象的方法是否很好,因为我会在任何地方使用它
Class User
Public Name
Public Adress
Public Title
Public Text
Public Rights 'ArrayList of Right objects
Private Sub Class_Initialize()
Initialize
End Sub
Private Sub Class_Terminate()
Dispose
End Sub
Private Sub Initialize()
Name = ""
Adress = ""
Title = ""
Text = ""
Set Rights = Server.CreateObject("System.Collections.ArrayList") ' Arraylist .net
End Sub
Private Sub Dispose()
End Sub
End Class
Class Right
Public Name
Private Sub Class_Initialize()
Initialize
End Sub
Private Sub Class_Terminate()
Dispose
End Sub
Private Sub Initialize()
Name = ""
End Sub
Private Sub Dispose()
End Sub
End Class
然后我这样做是为了实例化对象:
Dim myUser
Set myUser = New User
'Do some work
Set myUser = nothing 'Dispose the object
欢迎任何想法,建议或更正。感谢帮助。