Necesito usar estructura de clase en asp clásico. He escrito siguientes tres clases.Estructura de clase en asp clásico
category.asp
<%
Class Category
Private NameVar
Public Property Get Name()
Name = NameVar
End Property
Public Property Let Name(nameParam)
NameVar = nameParam
End Property
End Class
%>
Item.asp
<%
Class Item
Private NameVar
Private CategoryVar
Public Property Get Name()
Name = NameVar
End Property
Public Property Let Name(nameParam)
NameVar = nameParam
End Property
Public Property Get Category()
category = categoryVar
End Property
Public Property Let Category(categoryParam)
CategoryVar = categoryParam
End Property
End Class
%>
Test.ASP
<%
Dim CategoryVar
Set CategoryVar = New Category
CategoryVar.Name = "Weight"
Dim ItemVar
Set ItemVar = New Item
ItemVar.Name = "kg"
ItemVar.Category = CategoryVar
%>
<html>
<head>
<title>UoM Componet Testing</title>
</head>
<body>
<%= ItemVar.Name %><br/>
</body>
</html>
Cuando ejecuto el código, me he encontrado algún problema El error es:
Microsoft VBScript en tiempo de ejecución (0x800A01B6) El objeto no admite esta propiedad o método:.? 'CategoryVar'"
¿Cómo se puede explicar esto por favor me ayude
¿Usted intentó 'Set ItemVar.Category = CategoryVar'? –
He reproducido tu error, ¡es raro! – Rafael