Write a Console Application to create shape class & derive circle & rectangle from it to demonstrate the method over-riding concept


Module Module1
    Class Shape
        Public area As Double
        Public color As String
        Public Overridable Sub calcArea()
            Console.WriteLine("inside the get area method of Shape class")
            Console.WriteLine()
        End Sub
        Public Sub printArea()
            Console.WriteLine("the area of the Shape is: " + area.ToString())
        End Sub
    End Class
    Class Circle
        Inherits Shape
        Public radius As Double
        Public Overrides Sub calcArea()
            area = 3.1415 * radius * radius
        End Sub
    End Class
    Class Rectangle
        Inherits Shape
        Public width As Double
        Public height As Double
        Public Overrides Sub calcArea()
            area = width * height
        End Sub
    End Class
    Sub Main()
        Dim sap As New Shape
        sap.calcArea()
        Dim cir As New Circle
        Console.Write("Enter the radius of circle :")
        cir.radius = Convert.ToDouble(Console.ReadLine())
        cir.calcArea()
        cir.printArea()
        Dim rect As New Rectangle
        Console.Write("please enter the height of rectangle :")
        rect.height = Convert.ToDouble(Console.ReadLine())
        Console.Write("please enter the widht of rectangle :")
        rect.width = Convert.ToDouble(Console.ReadLine())
        rect.calcArea()
        rect.printArea()
        Console.ReadLine()
    End Sub
End Module


Read more...

Digital clock project iphone code GTU final year

  •  Digital clock application source code.
  •  UDP Project for GTU student......small Application.
  • This is application Development into xcode core coding.
  • This simple demo for useful for students or beginner.
  • This Project use to every final year student like MCA, BCA , Msc.it ,BSc.it , PGDCA ,B.E. , B.Tech, M.E. , M.Tech , C.E. / I.T. CSE. CS.
 by .. Hardik is computer engineer in rajkot,india.

         PHP developer.

         R.K.University  Rajkot..

Read more...

Timetable generation in java with source code free download

  • Final year student for MCA, BCA, Msc.it, Bsc.it, PGDCA,
  • BE Final year student ,UDP Project.
  • C.E./ I.T. C.S.E , C.S. Project for final year
 By.. Hardik H. Kothadia
        PHP Developer
        R.K.University Rajkot.

Read more...
Related Posts Plugin for WordPress, Blogger...

Engineering material

GTU IDP/ UDP PROJECT

GTU IDP/ UDP PROJECT

Patel free software download

  © Blogger templates The Professional Template by Ourblogtemplates.com 2008

Back to TOP