zoukankan      html  css  js  c++  java
  • VBS 类

    VBS类学习

    Class Student  '创建一个学生类

      Public sName '创建一个公有变量 学生名称

         Private sAge '创建一个私有变量  学生年龄

         Public Property Let SetSName(ByVal name) '定义公有的Let属性

        sName=name

         End Property

       Public Property Get GetSName() '定义公有的Set属性

        GetSName=sName       'VBS是弱类型的,将sName的赋值给GetSName返回

      End Property

      Private Sub Class_Initalize '设置类的初始化事件

        sAge=18

      End Sub

      Private Sub Class_terminate '设置类的清空事件

        Response.Write("类已经注销")

      End Sub

      Public Function GetStudent(ByVal name) 'Function过程可以有返回值

        call SetSName(name)

        GetStudent="姓名是"&GetSName&"年龄是"&sAge '&代表字符串拼接

      End Function

      Public Sub OutPutStudent() 'Sub过程没有返回值,但是可以调用系统的输入函数 InputBox  消息函数 MesBox 消息函数

        name=InputBox("请输入名称")

        call SetSName(name)

        Response.Write(姓名是"&GetSName&"年龄是"&sAge )  

      End Sub 

    End Class

  • 相关阅读:
    正则表达式的学习笔记
    apply()的使用
    for循环性能测试
    js基础复习~Array对象
    判断值是否为undefined
    layui 单选框取消选中
    layui 表单验证
    火狐浏览器下,表头边框无效
    css3 宽度百分比减去固定宽度 无效问题
    javaScript中的 call 和 apply
  • 原文地址:https://www.cnblogs.com/birchlee/p/1885100.html
Copyright © 2011-2022 走看看