This refers to both functions and subroutines. A
End Get Set(ByVal Value As String) msName = Value End Set End Property ‘ Overloaded constructor Overloads Sub New( ) End Sub ‘ Constructor that initializes name Overloads Sub New(ByVal sNewName As String) msName = sNewName End Sub Sub Dispose( ) ‘ Code here to clean up End Sub End Class 3.3.3 The Public Interface of a VB .NET Class We have seen that, when speaking in general object-oriented terms, the exposed members of a software component constitute the component’s public interface (or just interface). Now, in VB .NET, each member of a class module has an access type, which may be Public, Private, Friend, Protected, or ProtectedFriend. We discuss each of these in detail later in this chapter. Suffice it to say, a VB .NET class module may accordingly have Public, Private, Friend, Protected, and ProtectedFriend members. Thus, we face some ambiguity in defining the concept of the public interface of a VB .NET class. The spirit of the term might indicate that we should consider any member that is exposed outside of the class itself as part of the public interface of the class. This would include the Protected, Friend, and Protected Friend members, as well as the Public members. On the other hand, some might argue that the members of the public interface must be exposed outside of the project in which the class resides, in which case only the Public members would be included in the interface. Fortunately, we need not make too much fuss over the issue of what exactly constitutes a VB .NET class’ public interface, as long as we remain aware that the term may be used differently by different people. 3.3.4 Objects A class is just a description of some properties and methods and does not have a life of its own (with the exception of shared members, which we discuss later). In general, to execute the methods and use the properties of a class, we must create an instance of the class, officially known as an object. Creating an instance of a class is referred to as instancing, or instantiating, theclass. There are three ways to instantiate an object of a VB .NET class. One method is to declare a variable of the class’ type: Dim APerson As CPerson and then instantiate the object using the New keyword as follows: APerson = New CPerson( ) We can combine these two steps as follows:
Note: If you are looking for cheapest and affordable webspace to host and run your servlet application check Astra servlet hosting services