View Single Post
  #1 (permalink)  
Old September 28th, 2011, 11:50 PM
zavodney zavodney is offline
Authorized User
Points: 195, Level: 3
Points: 195, Level: 3 Points: 195, Level: 3 Points: 195, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: Tennessee
Posts: 46
Thanks: 27
Thanked 0 Times in 0 Posts
Default Ex 24-3 question

I am getting errors while fleshing out the Player class. With my class like this:

Code:
Public Class Player

    ' Declare the Name
    Public Property Name As String

    ' Create the backing variable for Points
    Private _Points As Integer
    ' Define the Points property
    Public Property Points As Integer

    ' Return the Level (Points\10)
    Public ReadOnly Property Level As Integer
        Get

        End Get
    End Property
End Class
I am receiving this error:

"variable '_Points' conflicts with a member implicitly declared for property 'Points' in class 'Player'."

and I do not have the Get and Set procedures created for me.

When I comment out the "Private _Points As Integer" line so I can at least use the automatic creation of the Get and Set procedures I still do not get them. I then created the Level Property and the automatic creation worked fine. I tried the Points Property again and still got nothing. Apparently I am missing something but I cannot figure it out. I am using Visual Studio Express. Help, please. Thank you.

Keith Z.
Reply With Quote