Features
      Ask DevGuru
      ASP Resources
      Find the Bug
      Knowledge Base
      Links
      Tips of the Week
      Tutorials
  Products
      dgCalendar
      dgCharge New!
      dgChart New!
      dgFileUpload
      dgReport New!
      dgSort
      dgTree
  Site
      Authoring
      Coming Soon
      DevGuru Resume
      Link to Us
      Merchandise
      Sponsorships
      Testimonials
      What's New
  Technologies
      ADO 2.6
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      Transact-SQL Syntax
      VBScript
      WML
      WMLScript
      WSH
      XML DOM

              











STATEMENT:  Class

Implemented in version 5.0
 
Class ... End Class
 
The Class statement block is used to create a Class object. You can only create (name) one Class object with each Class statement. This ability to create your own Class is a significant expansion of the usefulness of the VBScript language.
 
Within the block of the Class statement you can declare the members of the class, which are variables, methods, and properties. Methods of the class are implemented by defining a Sub or Function procedure, while properties are defined through the use of Property Get, Property Let, and Property Set statements. Any member of a class may be declared as either Public or Private, with a Public declaration being the default state. Private members of a class are only accessable by other members of the same class, while Public members are accessable by anything, inside or outside of the scope of the class.
 
The Class statement must always end with an End Class.
 
Example:
<%
Class DevGuruProducts

   ' Creating a private property using Get, Let, Set
   Private mstrName
   ' Get
   Public Property Get CustomerName()
      CustomerName = mstrName
   End Property
   ' Let
   Public Property Let CustomerName(strName)
      mstrName = strName
   End Property
   ' Set
   Public Property Set Guru(objGuru)
      Private mobjGuru
      Set mobjGuru = objGuru
   End Property

   ' Creating a private method using a function
   Private Function DevGuruProductName(intProduct)
      Select Case intProduct
      Case 1
         DevGuruProductName = "dgCharge"
      Case 2
         DevGuruProductName = "dgList"
      Case 3
         DevGuruProductName = "dgReport"
   End Function

End Class
%>


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information