声明或定义成员过程。
语法
参数
typename
fieldname
程序名称
external_name
外部链接时看到的字段名称
parameters
要传递给程序的参数
calling convention specifier
说明
例子
Type Statistics
count As Single
sum As Single
Declare Sub AddValue( ByVal x As Single )
Declare Sub ShowResults( )
End Type
Sub Statistics.AddValue( ByVal x As Single )
count += 1
sum += x
End Sub
Sub Statistics.ShowResults( )
Print "值数="; count
Print "平均=";
If( count > 0 ) Then
Print sum / count
Else
Print "N/A"
End If
End Sub
Dim stats As Statistics
stats.AddValue 17.5
stats.AddValue 20.1
stats.AddValue 22.3
stats.AddValue 16.9
stats.ShowResults
输出:
Number of Values = 4
Average = 19.2
方言差异
参考