ASP Class

Source: Internet
Author: User
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, can I write ASP programs like objects ?! 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 is the first time I have heard of it, our daily work is website development. In this case, we have more or less experience, and we can also boast of being "professional". So I will share what I know about this new stuff. Let's take a look at the following code! (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 !!!
You can write the commonly used programs into a class, and then use it <! -- # Include file = "xxx. asp" --> to include the file. This provides us with a new space for developing programs.
From: http://goaler.xicp.net/ShowLog.asp? ID = 466

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.