Appendix D. Subroutine and Function Declarations
This appendix provides information about subroutine, function, and generic declarations. A property procedure includes a subroutine and function pair, so they are also described here.
Subroutines
The syntax for writing a subroutine is as follows:
[attribute_list] [interitance_mode] [accessibility] Subsubroutine_name[(parameters)] [ Implementsinterface.procedure] [statements] End Sub
The inheritance_mode can be one of the following values: Overloads, Overrides, Overridable, NotOverridable, MustOverride, Shadows, or Shared. These values determine how a subroutine declared within a class inherits from the parent class or how it allows inheritance in derived classes.
The accessibility clause can take one of the following values: Public, Protected, Friend, Protected Friend, or Private. These values determine which pieces of code can invoke the subroutine.
Functions
The syntax for writing a function is as follows:
[attribute_list] [interitance_mode] [accessibility] _ Functionfunction_name([parameters]) [Asreturn_type] [ Implementsinterface.function] [statements] End Function
This is the same as the syntax used for declaring a subroutine, except that a function includes a return type and ends with End Function.
The inheritance_mode can be one of the values Overloads, Overrides, Overridable, NotOverridable, MustOverride, Shadows, or Shared. These values determine how a subroutine declared within a class inherits from the parent class or ...
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