Link to home
Start Free TrialLog in
Avatar of fahVB
fahVB

asked on

class definitions

Can someone tell me what is wrong with this and how it is defined. I need to identify those areas that are incorrect and indicate what I need to do to fix it.  It has to do something with basic class definitions, please help...

Public Class _MyClass
    Private MyName As String
    Private MyAddress As String
    Public MyCity As String

    Private Property GetName()
        Get
            Return MyName
        End Get
        Set(ByVal Value)
            Value = MyName
        End Set
    End Property

    Public Property MyAddress()
        Get
            Return MyAddress
        End Get
        Set(ByVal Value)
            MyAddress = Value
        End Set
    End Property

    Public ReadOnly Property GetCity()
        Get
            Return GetCity
        End Get
    End Property

    Public Function CheckZipCode() As Boolean
        If IsNumeric(MyZipCode) = False Then
            Return False
        Else
            Return True
        End If
    End Function

    Private Sub CapitalizeNames()
        MyName = MyName.ToUpper
    End Sub
End Class


SOLUTION
Avatar of Kinger247
Kinger247

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kinger247
Kinger247

In fact theres a whole lot wrong with it (disregard number 2 previously).
whats this for ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
3) you should have Imports Microsoft.VisualBasic if you are going to use the IsNumeric function (on the CheckZipCode function)
4)
on
Public ReadOnly Property GetCity()
        Get
            Return GetCity
        End Get
    End Property

it should read
Public ReadOnly Property GetCity()
        Get
            Return MyCity
        End Get
    End Property

because you cant return a property.
This looks like an exam question to me ???????????????????????????????
5) MyName = MyName.ToUpper
lacks the ending ()
Avatar of fahVB

ASKER

wow too many suggestions. It is an exam question though. How do I allocate points now? So many guru's....

I think you should give us 500 each ;)
and if you pass your exam, a beer.
10% to Kinger247
10% to Nightman
80% to newyuppie

IMHO - Kinger and I both shot from the hip - newyuppie gave some really good feedback.
But then I twigged what this was for !
Avatar of fahVB

ASKER

Thanks for the suggestions guys.
thanks to you, and thanks nightman for your opinion, but anyway i think you two also had very good points there. cheers
NY