VBScript Class

Output

initialize
constructed
destructed
finalize

Sources

/vbsclass.asp

<!--#include virtual="/lib/unit-tests.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
    <head>
        <title>Unit Test - VBScript Class</title>
        <!--// meta tags //-->
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <!--// link tags //-->
        <link rel="stylesheet" type="text/css" media="screen" href="/lib/unit-tests.css" />
    </head>
    <body>
        <div id="container">
            <div id="container-hd">
                <h1>VBScript Class</h1>
            </div>
            <div id="container-bd">
 
<h2>Output</h2>
<div class="code"><pre><%
 
class SomeClass
 
    public someProperty
 
    public default function [new]()
        Response.write("constructed")
        Response.write(vbNewLine)
        set [new] = Me
    end function
 
    public sub dispose()
        Response.write("destructed")
        Response.write(vbNewLine)
    end sub
 
    ' --[ Private section ]-----------------------------------------------------
 
    private sub Class_initialize()
        someProperty = "defaultValue"
 
        Response.write("initialize")
        Response.write(vbNewLine)
    end sub
 
    private sub Class_terminate()
        Response.write("finalize")
        Response.write(vbNewLine)
    end sub
 
end class
 
with (new SomeClass)()
    .dispose()
end with
 
%></pre></div>
 
            </div>
            <div id="container-ft">
                <h2>Sources</h2>
                <h3><%= Request.ServerVariables("SCRIPT_NAME") %></h3>
                <div class="code"><%= geshify( loadTextFile( Server.mapPath( Request.ServerVariables("SCRIPT_NAME") ) ), "asp" ) %></div>
            </div>
        </div>
        <!--// javascript tags //-->
    </body>
</html>