VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Simple way to make equal two classes

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

Simple way to make equal two 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
'///////////////////////////////////////////////////////////////////'
Public Sub equality(cub As cube)
cub.a = a
cub.area = area
cub.volume = volume
End Sub


Rate Simple way to make equal two classes



'and add one command button
'////
Dim cube1 As New cube
Dim cube2 As New cube

Private Sub Command1_Click()
cube1.a = InputBox("Insert the side length ", "")
cube1.Calculate
Print "Cube1" & vbCrLf
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
Print vbCrLf
cube1.equality cube2
cube2.Calculate
Print "Cube2" & vbCrLf
Print "The area of a square with a side  = " & cube2.a & vbCrLf & " is equal to " & cube2.area
Print vbCrLf
Print "The volume of a cube with a side = " & cube2.a & vbCrLf & " is equal to " & cube2.volume

End Sub



Download this snippet    Add to My Saved Code

Simple way to make equal two classes Comments

No comments have been posted about Simple way to make equal two classes. Why not be the first to post a comment about Simple way to make equal two classes.

Post your comment

Subject:
Message:
0/1000 characters