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

  • 相关阅读:
    mysql5.7 ERROR 1045 (28000): Access denied for user解决方法
    C++ json解决方案
    Gitblit无法查看单个文件解决方案
    git 拉取指定的远程分支(三种方式)
    全栈12
    git commit之后,想撤销commit
    video
    iframe
    git恢复之前版本的两种方法reset、revert
    Eclipse
  • 原文地址:https://www.cnblogs.com/birchlee/p/1885100.html
Copyright © 2011-2022 走看看