vba-类

发布时间 2023-08-10 17:14:15作者: vba是最好的语言

1.基本使用

' 长方体的类Cuboid
Private are
Private hig
 
Property Get area()
    area = are
End Property

Property Get high()
    high = hig
End Property

Function volume()
    volume = area * high
End Function

Function init(area, high)
    are = area
    hig = high
End Function

基本使用

Public Sub classt()
Dim cuboid As New cuboid
Call cuboid.init(2, 4)

MsgBox cuboid.volume
End Sub

2 .