![]() ![]() | ||
As discussed in the In Depth section of this chapter, the fields of a class, also called the class's data members, are much like built-in variables. For example, in the In Depth section of this chapter, I declared a field named value in a class named DataClass:
Public Class DataClass
Public value As Integer
End Class
Now I can refer to that field in an object of this class using the familiar object.field syntax of Visual Basic:
Dim data As New DataClass()
data.value = 5
You also can make fields hold constant values with Const:
These data members are object data members—you use them with a specific object. However, you also can create class data members; see the next topic for the details.
Related solution: |
Found on page: |
---|---|
73 |
![]() ![]() | ||