CLASSES
A class packages data and related behavior. For example, a WorkOrder class might store data describing a customer’s work order in its properties. It could contain methods (subroutines and functions) for manipulating the work order. It might provide methods for scheduling the work, modifying the order’s requirements, and setting the order’s priority.
Here is the syntax for declaring a class:
[attribute_list] [Partial] [accessibility] [Shadows] [inheritance] _
Class name[(Of type_list)]
[Inherits parent_class]
[Implements interface]
statements
End Class
The only things that all class declarations must include are the Class clause (including the class’s name) and the End Class statement. Everything else is optional. The following code describes a valid (albeit not very interesting) class:
Class EmptyClass
End Class
The following sections describe the pieces of the general declaration in detail.
Attribute_list
The optional attribute_list is a comma-separated list of attributes that apply to the class. An attribute further refines the definition of a class to give more information to the compiler and the runtime system.
<Serializable(), Obsolete("No longer supported. Use Sku instead")> Public Class SkuNumber ... ...
Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.