Simple way to start learning classes
Simple way to start learning classes
API Declarations
'////
Public a As Double
Public area As Double
Public volume As Double
Private Sub Class_Initialize()
a = 0
area = 0
volume = 0
End Sub
Public Sub Calculate()
area = a * a
volume = area * a
End Sub
Rate Simple way to start learning classes
(1(1 Vote))
'and add one command button
'////
Dim cube1 As New Cube
Private Sub Command1_Click()
cube1.a = InputBox("Insert the side length ", "")
cube1.Calculate
Print "The area of a square with a side = " & cube1.a & vbCrLf & " is equal to " & cube1.area
Print vbCrLf
Print "The volume of a cube with a side = " & cube1.a & vbCrLf & " is equal to " & cube1.volume
End Sub
Simple way to start learning classes Comments
No comments yet — be the first to post one!
Post a Comment