Introduction
Author: http://www.aspcn.com; flying knife
One day before, when I read VBScript to solve a syntax problem, I accidentally found the following sentence:
Class statement
Declares the name of a class, as well as a definition of the variables, properties, and methods that comprise the class.
The translation is ......
Class Declaration
Declaring a class name is to define some variables, attributes, and methods to form a class.
This is true !!!? You can use classes in VBScript !?!? I wonder if it can be used in ASP !? In this way, I cannot write ASP files like objects.Program?! Just do it! Practice is the only criterion for testing truth. Do it yourself!
We often see descriptions of classes in other programming languages, such as PHP, VB, and C. This class description in VBScript. I heard it for the first time. Our daily work is website development, in this case, we have more or less experience, and we can also boast an "expert", so I will share what I know about this new stuff. Let's take a look at the following:CodeRight! (Window2000 iis5.0 passed the test)
<%
''Declares a class named aspcn.
Class aspcn
Private aspcn
''Initialization class
Private sub class_initialize
Aspcn = "aspcn is good! <Br>"
End sub
''Defines a function
Public Function doit ()
Doit = aspcn
End Function
''Defines a method
Public sub querystr (STAT)
Response. Write stat
End sub
End Class
Set hi_aspcn = new aspcn ''defines an aspcn object instance 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. We declare a class named aspcn in it, and create a doit function and a querystr method. This program is very simple for everyone to understand. Its display is as follows:
Aspcn is good!
Aspcn is cool!
Http://www.aspcn.com
Welcome !!!
In the future, we will be able to write the programs we commonly use into a class, and then use them <! -- # Include file = "XXX. asp" --> to include the file. This provides us with a new space for developing programs! Like C, it's a bit natural.
BenArticleFrom http://www.aspcn.com; ASP Chinese network if you want to reprint please be sure to indicate the source, thank you