Appendix K. Classes and Structures
This appendix provides information about class and structure declarations.
Classes
The syntax for declaring a class is:
[attribute_list
] [Partial] [accessibility
] [Shadows] [inheritance
] _ Classname
[(Oftype_list
)] [Inheritsparent_class
] [Implementsinterface
]statements
End Class
The attribute_list
can include any number of attribute specifiers separated by commas.
The accessibility
clause can take one of the following values: Public
, Protected
, Friend
, Protected Friend
, and Private
.
The Partial
keyword indicates that this is only part of the class declaration and that the program may include other partial declarations for this class.
The Shadows
keyword indicates that the class hides the definition of some other entity in the enclosing class's base class.
The inheritance
clause can take the value MustInherit
or NotInheritable
.
The type_list
clause defines type parameters for a generic class. For information on generics, see Chapter 29, "Generics."
The Inherits
statement tells which class this class inherits from. A class can include at most one Inherits
statement and, if present, this must be the first non-comment statement after the Class
statement.
The Implements
statement specifies an interface that the class implements. A class can implement any number of interfaces. You can specify interfaces in separate Interface
statements or in a single statement separated by commas.
The following example declares a simple Person
class and an Employee
class that ...
Get Visual Basic® 2008 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.