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

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

January 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 11 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

KB101398



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
T1.IntroduceYourself() 
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" 
T1.IntroduceYourself() 

 

The  following is written to your browser:

Hi, my name is Number 1.

More Info

KB Post:  Creating a Class in ASP

Comments

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

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

---
Kiran
Posted 51 months ago

Comment 2 of 2

ASP Classic Class is basically creative for the readers. We can adopt different best assignment writing services ideas with the help of this site. I just like the way the blogger has created this website for the reasers.

Posted 15 days 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 = P1212A1
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 play-drums.com 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
14217
Since 10/24/2008
-
   Contact Us!
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


Go ahead!   Use Us! Call: 916-726-5675 


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