Name
Class Statement
Syntax
[accessmodifier] [inheritability] ClassName statements
End Class-
accessmodifier Use: Optional
Type: Keyword
The possible values of
accessmodifierarePublic,Private, andFriend. For more information, see Section 3.7 in Chapter 3.-
inheritability Use: Optional
Type: Keyword
One of the keywords,
MustInheritorNotInheritable, must be used.MustInheritspecifies that objects of this class cannot be created, but that objects of derived classes can be created.NotInheritablespecifies that this class cannot be used as a base class.-
ClassName Use: Required
Type: String literal
This is the name of the class.
Description
Defines a class and delimits the statements that define that class’ variables, properties, and methods. For a detailed discussion with examples, see Chapter 3.
Rules at a Glance
ClassNamefollows standard Visual Basic variable-naming conventions.Within a class code block, members are declared as
Public,Private,Protected,Friend, orProtectedFriend. TheDimkeyword is equivalent toPrivatewhen used in class modules (but it is equivalent toPublicin structures). Property declarations are automaticallyPublic.The
Class...EndClassconstruct can include the following elements:- Private variable or procedure declarations
These items are accessible within the class, but do not have scope outside of the class.
- Public variable or procedure declarations
Publicvariables are public properties of the class;Publicprocedures are public methods of the class. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access