设计一个圆类CIRCLE
发布网友
发布时间:2023-05-03 09:59
我来回答
共1个回答
热心网友
时间:2023-10-19 10:06
Mole Mole1
Sub Main()
Dim c As New Circle
c.SetRadius(1)
c.Show()
End Sub
End Mole
Public Class Circle
Private radius As Double
Private area As Double
Public Sub New()
radius = 0.0
area = Math.PI * radius ^ 2
End Sub
Public Sub SetRadius(ByVal R As Double)
radius = R
area = Math.PI * radius ^ 2
End Sub
Public Sub Show()
Console.WriteLine("半径:" & radius)
Console.WriteLine("面积:" & area)
End Sub
Protected Overrides Sub Finalize()
MyBase.Finalize()
Console.WriteLine("Good Bye!")
Console.Read()
End Sub
End Class