Use classes (Class) in your ASP

Source: Internet
Author: User
Tags define variables vbscript class
Introduced
Author: http://www.aspcn.com Flying Knife

In the day before, when I read the VBScript document to solve a grammatical problem, I stumbled across the following sentence:

Class Statement

Declares the name of a class, as a definition of the variables, properties, and methods that comprise the class.

The translation comes from ...

Class Declaration

Declaring the name of a class is defining variables, attributes, and methods to form a class

It's true!!!? Can I use class!?! in VBScript? Do not know can be used for asp!? In this way, I am not able to write an object like the ASP program?! Do what you say! Practice is the only standard to test truth, do it yourself!

We often see other programming languages have classes in the description, php,vb,c++, this in VBScript class description, I was the first time to hear, our daily work is the website development, in this more or less to make some experience, can also boast as "expert", So I'm going to share what I know about this new stuff. Let's take a look at the code below! (window2000+iis5.0 passed the test)

<%
"Declares a class named ASPCN
Class ASPCN
Private ASPCN
' Initialize class
Private Sub Class_Initialize
Aspcn= "ASPCN is good!<br>"
End Sub
"Define a function
Public Function DoIt ()
Doit=aspcn
End Function
"Define a method
Public Sub QUERYSTR (STAT)
Response.Write Stat
End Sub

End Class

Set hi_aspcn=new ASPCN ' defines an instance of a Aspcn object named HI_ASPCN
Response.Write HI_ASPCN. DoIt
Varstr= "ASPCN is Cool!<br><font color=red>http://www.aspcn.com</font><br>welcome!!!"
HI_ASPCN. Querystr Varstr

%>


This is a very simple program, in which we declare a class named ASPCN, set up a doit function, a querystr method, which is very simple to believe that you can read, it shows as follows:

ASPCN is good!
ASPCN is cool!
Http://www.aspcn.com
WelCome!!!

Later, we will be able to use the program we used to write a class, and then with <! --#include file= "xxx.asp"--> to include in the line, which gives us the development of the program and provide a new space, really cool ah! and C + +, a bit back to the feeling of nature.

This article from the Http://www.aspcn.com ASP China Network If you want to reprint please be sure to indicate the source, thank you



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.