Implement a program to calculate area of circle using parameterized constructor in

Module Module1

    Class Area

        Private r As Double

        Public Sub New(ByVal temp As Double)

            r = temp


        End Sub

        Public Function getArea() As Double

            Return Math.PI * MathPow(r, 2)

        End Function

    End Class

    Sub Main()

        Dim a As New Area(5.0)

        Console.Write("Area of Circle :{0}", a.getArea())



    End Sub


End Module

Area of Circle:78.5398


  1. Error 1 'MathPow' is not declared. It may be inaccessible due to its protection level. C:\Users\PRANAY\AppData\Local\Temporary Projects\ConsoleApplication1\Module1.vb 17 30 ConsoleApplication1


Post a Comment

If you have any query, please let us know