Working Example
The following working example contains both a constructor and destructor, ASP's Class_Initialize and Class_Terminate subs. In this example, we are implicitly destroying the object (letting IIS destroy the object when the variable goes out of scope).
You can explicitly destroy an object by using Set MyRobot = Nothing. In ASP Classic, it is recommended that you explicitly destroy all objects.
<%@LANGUAGE=VBScript%>
<%Option Explicit%>
<html>
<body>
<%
Dim MyRobot
Set MyRobot = new Cyborg
Response.Write "<br>My robot's name is " & MyRobot.CyborgName & "."
//Object destroyed implicitly here
//and Class_Terminate is called.
%>
</body>
</html>
<%
Class Cyborg
Public CyborgName
Public Sub Class_Initialize
Response.Write "<br>Class created"
CyborgName = "Cameron"
End Sub
Public Sub Class_Terminate
Response.Write "<br>Class destroyed"
End Sub
End Class
%>