Class Colored Circle Learn programming Visual Basic (VB.net)

Lesson:

OOP Object Oriented Programming


Exercise:

Class Colored Circle


Objetive:

Expand the January 10th exercise (shapes + square), so that it can also store data about "Colored Circles":


Code:

Imports System
Namespace shapes
    Class ColoredCircle
        Inherits Circle

        Protected color As Integer

        Public Sub New()
        End Sub

        Public Sub New(ByVal dX As Double, ByVal dY As Double, ByVal dRadius As Double, ByVal color As Integer)
            Me.dX = dX
            Me.dY = dY
            Me.dRadius = dRadius
            Me.color = color
        End Sub

        Public Sub Move()
        End Sub

        Public Sub Scale()
        End Sub

        Public Function ToString() As String
            Return ""
        End Function

        Public Function GetColor() As Integer
            Return 0
        End Function

        Public Sub SetColor(ByVal newColor As Integer)
            color = newColor
        End Sub

        Public Overrides Function Area() As Double
            Return 0
        End Function

        Public Overrides Function Perimeter() As Double
            Return 0
        End Function
    End Class
End Namespace

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.