VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple way to start learning classes

by Chrysovalantis Anastasiades (5 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 6th October 2008
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



'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


Download this snippet    Add to My Saved Code

Simple way to start learning classes Comments

No comments have been posted about Simple way to start learning classes. Why not be the first to post a comment about Simple way to start learning classes.

Post your comment

Subject:
Message:
0/1000 characters