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 & ".")