brainleak
Well-known member
I was wondering if it's correct -I mean sound programming habit- to refer to a class from another class if they have nothing to do with each other.
For example,
Clearly Class1 is meaningless without Class2. Should they go under a unique namespace?
For example,
VB.NET:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim c1 As New Class1
Console.WriteLine(c1.Result)
End Sub
End Class
Public Class Class1
Dim c2 As New Class2(3, 7, 4, 8)
Public Function Result() As Integer
Return c2.x1 + c2.x2 + c2.x3 + c2.x4
End Function
End Class
Public Class Class2
Public Sub New(i1 As Integer, i2 As Integer, i3 As Integer, i4 As Integer)
x1 = i1
x2 = i2
x3 = i3
x4 = i4
End Sub
Public x1, x2, x3, x4 As Integer
End Class