The reason that the instance fields are often just values
Classes and Objects (with a Short Introduction to Object-Oriented Programming)
Public Function Add(ByVal z1 As ComplexNumber) As ComplexNumber Dim z As ComplexNumber
z.real = Me.real + z1.real
z.complex = Me.complex + z1.complex
Return z
End Function
'much more code
End StructureSub Main()
Dim Z1 As New ComplexNumber(2.3, 2.4)
Dim Z2, Z3 As ComplexNumber
Z2.real = 1.3
Z2.complex = 1.4
Z3 = Z1.Add(Z2)
Console.WriteLine(Z3.real)
Console.ReadLine()
End Sub
NOTE |
|
---|
|
---|
167
You can place any class, enum, structure, or module in a namespace. Of course, you cannot create an instance of a module—only instances of the classes defined in the module. In the Project Properties dialog box, as shown in Figure 4-9, you see a space for the assembly name and also for the root namespace.