We’ve seen that modifiers like Public and Private control the visibility of a type member. VB exposes another set of modifiers and keywords that control how types interact within a class hierarchy.
Shared
The shared keyword declares a member that belongs to the type itself, not an instance of the type. These are referred to as STATIC MEMBERS. By the way, VB doesn’t support the SHARED keyword at the class level, but you can achieve the same thing using a VB-specific file called a MODULE. We’ll see how to do that in a few pages.
Public Class Recipe Public Function Shared TabsToTsps(tabs As Integer) Return tabs * 3 End Function End Class
NotOverridable
The NotOverridable keyword, which only applies to classes, indicates that the class cannot be used as the base for any other class. Classes that can’t be inherited are called SEALED CLASSES.
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.