|
-
Apr 22nd, 2002, 10:54 AM
#7
You're absolutely right tygur, on both accounts.
I misread the question, and ReadOnly variables act like constants.
There are only a few differences between contants and ReadOnly variables.
Next to initializing the variable inline (Public ReadOnly curX As Integer = 5), you can also give it a value in the classes constructor.
VB Code:
Public ReadOnly curX As Integer
Public Sub New()
curX = 6
End Sub
Public Sub New(ByVal NewX As Integer)
curX = Newx
End Sub
ReadOnly variables can be of any type, including reference type variables, where constants can only be Boolean, Byte, Char, Date, Decimal, Double, Integer, Long, Object, Short, Single, String, or the name of an enumeration.
Last edited by Frans C; Apr 22nd, 2002 at 10:58 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|