Your full service technology partner! 
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

-Collapse +Expand ASP Classic Store

Prestwood eMagazine

July Edition
Subscribe now! It's Free!
Enter your email:

   ► KBWebsite Scri...ASP ClassicOOP   Print This     
  From the October 2015 Issue of Prestwood eMag
ASP Classic OOP:
ASP Classic Class..Object (Class..Set..New)
Posted 16 years ago on 10/24/2008 and updated 1/28/2009
ASP Classic Code Snippet:
 A flashcard from our ASP Classic Flashcards Library
 A code snippet from our ASP Classic Code Snippets Page


Languages Focus: Class..Object

In short, a class is a data type, and an object is an instance of a class type. A class has methods (routines), properties (member variables), and a constructor. The current values of the properties is the current state of the object. The UML is one of the diagraming disciplines that allows you to document the various changing states of a series of objects.

ASP Classic Class..Object

Ultra-primitive (no inheritance) but useful and encourages you to think and design using objects. Unlike VB, you can have more than one class per file.

Classes in ASP do support member fields, properties, and methods.

Syntax Example:
'Declare class.
Class Cyborg
  Public Function IntroduceYourself() 
    Response.Write("Hi, I do not have a name yet.") 
  End Function 
End Class
'Create object from class.
Set T1 = new Cyborg
Set T1 = Nothing      'Be sure to clean up!

Add a Member Field

Now let's give our cyborg a name using a public member field.

Note: In a real application, you would use a public property for the CyborgName and reserve member fields for internal class operations. For an exmaple of how to turn the CyborgName member field into a prroperty, refer to our ASP Classic Member Property article.

'Declare class.
Class Cyborg
  Public Function IntroduceYourself() 
    Response.Write("Hi, my name is " & CyborgName & ".") 
  End Function
  Public CyborgName 
End Class
'Create object from class.
Dim T1
Set T1 = New Cyborg
T1.CyborgName = "Number 1" 


The  following is written to your browser:

Hi, my name is Number 1.

More Info

KB Post:  Creating a Class in ASP


Share a thought or comment...
Comment 1 of 1

In my asp page some user send junk values. So please let me know how can i solve this problem

Posted 10 years ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1244A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101398 Counter
Since 10/24/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2024 Prestwood IT Solutions.   [Security & Privacy]