8. Visual Basic.NET新機能
~コードの例~
ImportsSystem.Math
NamespaceGeometry
Public ModuleModule1
Public ClassTriangle
Dim tri As NewTriangle(2, 3, 4)
Console.WriteLine(tri.Compute())
Dimma, mb, mc As Integer
Dims As Double = (ma + mb + mc) / 2
Return Sqrt(s * (s -ma) * (s...
ImportsSystem.Math
NamespaceGeometry
Public ModuleModule1
SubMain()
Dimtri As NewTriangle(2, 3, 4)
Console.WriteLine(tri.Compute())
End Sub
End Module
Public Class Triangle
Dimma, mb, mc As Integer
Overloads Public SubNew(a As Integer, b As Integer, c As Integer)
ma = a : mb = b : mc = c
End Sub
Public Function Compute() As Double
Dims As Double= (ma + mb + mc) / 2
ReturnSqrt(s * (s –ma) * (s –mb) * (s –mc))
End Function
End Class
End Namespace